Fix Win32 build with CMake and MSVC

This commit is contained in:
Mikhail Titov 2015-06-06 03:33:15 -05:00
parent d9c0f52846
commit a3b08c0016
2 changed files with 51 additions and 3 deletions

View file

@ -12,6 +12,9 @@ else(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
/opt/local/include/crypto++
/opt/local/include/cryptopp
$ENV{SystemDrive}/Crypto++/include
$ENV{CRYPTOPP}
$ENV{CRYPTOPP}/include
${PROJECT_SOURCE_DIR}/../../cryptopp
)
find_library(CRYPTO++_LIBRARIES NAMES cryptopp
@ -20,8 +23,32 @@ else(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
/usr/local/lib
/opt/local/lib
$ENV{SystemDrive}/Crypto++/lib
$ENV{CRYPTOPP}/lib
)
if(MSVC AND NOT CRYPTO++_LIBRARIES) # Give a chance for MSVC multiconfig
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(PLATFORM x64)
else()
set(PLATFORM Win32)
endif()
find_library(CRYPTO++_LIBRARIES_RELEASE NAMES cryptlib cryptopp
PATHS
$ENV{CRYPTOPP}/Win32/Output/Release
${PROJECT_SOURCE_DIR}/../../cryptopp/${PLATFORM}/Output/Release
)
find_library(CRYPTO++_LIBRARIES_DEBUG NAMES cryptlib cryptopp
PATHS
$ENV{CRYPTOPP}/Win32/Output/Debug
${PROJECT_SOURCE_DIR}/../../cryptopp/${PLATFORM}/Output/Debug
)
set(CRYPTO++_LIBRARIES
debug ${CRYPTO++_LIBRARIES_DEBUG}
optimized ${CRYPTO++_LIBRARIES_RELEASE}
CACHE PATH "Path to Crypto++ library" FORCE
)
endif()
if(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
set(CRYPTO++_FOUND TRUE)
message(STATUS "Found Crypto++: ${CRYPTO++_INCLUDE_DIR}, ${CRYPTO++_LIBRARIES}")