Permalink
Browse files

Fix checks for crypto algorithms in Visual Studio builds.

Checks were failing because /SAFESEH was being used and because ssize_t was not defined.
  • Loading branch information...
amejia1 committed Feb 1, 2013
1 parent c13f706 commit 58dc42aaea93cd281aafaaaa4c3926c3578b7e26
Showing with 16 additions and 3 deletions.
  1. +15 −3 CMakeLists.txt
  2. +1 −0 libarchive/archive_windows.h
View
@@ -564,7 +564,7 @@ MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION)
# Probe the local implementation for whether this
# crypto implementation is available on this platform.
SET(TRY_CRYPTO_REQUIRED_INCLUDES
- "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_CURRENT_SOURCE_DIR}/libarchive;${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp")
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libarchive;${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp")
SET(TRY_CRYPTO_REQUIRED_LIBS)
IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND)
SET(TRY_CRYPTO_REQUIRED_INCLUDES
@@ -604,10 +604,16 @@ main(int argc, char **argv)
FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.c" "${SOURCE}")
MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}")
+ IF(CMAKE_REQUIRED_LINKER_FLAGS)
+ SET(CHECK_CRYPTO_ADD_LINKER_FLAGS
+ "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS}")
+ ELSE(CMAKE_REQUIRED_LINKER_FLAGS)
+ SET(CHECK_CRYPTO_ADD_LINKER_FLAGS)
+ ENDIF(CMAKE_REQUIRED_LINKER_FLAGS)
TRY_COMPILE(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.c
- CMAKE_FLAGS
+ CMAKE_FLAGS ${CHECK_CRYPTO_ADD_LINKER_FLAGS}
"${TRY_CRYPTO_REQUIRED_LIBS}"
"${TRY_CRYPTO_REQUIRED_INCLUDES}"
OUTPUT_VARIABLE OUTPUT)
@@ -684,10 +690,16 @@ main(int argc, char **argv)
FILE(WRITE "${SOURCE_FILE}" "${SOURCE}")
MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN")
+ IF(CMAKE_REQUIRED_LINKER_FLAGS)
+ SET(CHECK_CRYPTO_WIN_ADD_LINKER_FLAGS
+ "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS}")
+ ELSE(CMAKE_REQUIRED_LINKER_FLAGS)
+ SET(CHECK_CRYPTO_WIN_ADD_LINKER_FLAGS)
+ ENDIF(CMAKE_REQUIRED_LINKER_FLAGS)
TRY_COMPILE(ARCHIVE_CRYPTO_${CRYPTO}_WIN
${CMAKE_BINARY_DIR}
${SOURCE_FILE}
- CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_CURRENT_SOURCE_DIR}/libarchive"
+ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libarchive" ${CHECK_CRYPTO_WIN_ADD_LINKER_FLAGS}
OUTPUT_VARIABLE OUTPUT)
IF (ARCHIVE_CRYPTO_${CRYPTO}_WIN)
@@ -72,6 +72,7 @@
#endif
#define NOCRYPT
#include <windows.h>
+#include <config.h>
//#define EFTYPE 7
#if defined(__BORLANDC__)

0 comments on commit 58dc42a

Please sign in to comment.