1+ find_package (PkgConfig )
2+
13include (CheckCXXCompilerFlag )
24include (CheckFunctionExists )
35include (CheckIncludeFiles )
@@ -117,6 +119,14 @@ else(DISABLE_NON_PAGED_MEMORY)
117119 endif (NOT "${MLOCK_SIZE} " STREQUAL "unlimited" )
118120endif (DISABLE_NON_PAGED_MEMORY )
119121
122+
123+ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
124+ # disable
125+ # C4996 warning for deprecated posix function name
126+ # C4456 declaration of 'identifier' hides previous local declaration
127+ set (COMPILE_OPTIONS "/MP;/W4;/wd4996;/wd4456" )
128+ endif ()
129+
120130# Check if -ldl exists (equivalent of acx_dlopen.m4)
121131check_library_exists (dl dlopen "" HAVE_DLOPEN )
122132check_function_exists (LoadLibrary HAVE_LOADLIBRARY )
@@ -150,8 +160,8 @@ if(WITH_CRYPTO_BACKEND STREQUAL "botan")
150160 message (FATAL_ERROR "Failed to find Botan!" )
151161 endif ()
152162
153- set (CRYPTO_INCLUDES ${BOTAN_INCLUDE_DIRS } )
154- set (CRYPTO_LIBS ${BOTAN_LIBRARIES } )
163+ set (CRYPTO_INCLUDES ${BOTAN_INCLUDE_DIR } )
164+ set (CRYPTO_LIBS ${BOTAN_LIBRARY } )
155165 message (STATUS "Botan: Includes: ${CRYPTO_INCLUDES} " )
156166 message (STATUS "Botan: Libs: ${CRYPTO_LIBS} " )
157167
@@ -167,7 +177,7 @@ if(WITH_CRYPTO_BACKEND STREQUAL "botan")
167177
168178 # acx_botan_ecc.m4
169179 if (ENABLE_ECC)
170- set (testfile ${CMAKE_SOURCE_DIR} /modules/tests/test_botan_ecc.cpp)
180+ set (testfile ${CMAKE_SOURCE_DIR} /cmake/ modules/tests/test_botan_ecc.cpp)
171181 try_run (RUN_ECC COMPILE_RESULT
172182 "${CMAKE_BINARY_DIR} /prebuild_santity_tests" ${testfile}
173183 LINK_LIBRARIES ${CRYPTO_LIBS}
@@ -188,7 +198,7 @@ if(WITH_CRYPTO_BACKEND STREQUAL "botan")
188198 # acx_botan_eddsa.m4
189199 if (ENABLE_EDDSA)
190200 # ED25519
191- set (testfile ${CMAKE_SOURCE_DIR} /modules/tests/test_botan_ed25519.cpp)
201+ set (testfile ${CMAKE_SOURCE_DIR} /cmake/ modules/tests/test_botan_ed25519.cpp)
192202 try_run (RUN_ED25519 COMPILE_RESULT
193203 "${CMAKE_BINARY_DIR} /prebuild_santity_tests" ${testfile}
194204 LINK_LIBRARIES ${CRYPTO_LIBS}
@@ -208,7 +218,7 @@ if(WITH_CRYPTO_BACKEND STREQUAL "botan")
208218
209219 # acx_botan_gost.m4
210220 if (ENABLE_GOST)
211- set (testfile ${CMAKE_SOURCE_DIR} /modules/tests/test_botan_gost.cpp)
221+ set (testfile ${CMAKE_SOURCE_DIR} /cmake/ modules/tests/test_botan_gost.cpp)
212222 try_run (RUN_GOST COMPILE_RESULT
213223 "${CMAKE_BINARY_DIR} /prebuild_santity_tests" ${testfile}
214224 LINK_LIBRARIES ${CRYPTO_LIBS}
@@ -234,7 +244,7 @@ if(WITH_CRYPTO_BACKEND STREQUAL "botan")
234244 set (HAVE_AES_KEY_WRAP 1)
235245
236246 # acx_botan_rfc5649.m4
237- set (testfile ${CMAKE_SOURCE_DIR} /modules/tests/test_botan_rfc5649.cpp)
247+ set (testfile ${CMAKE_SOURCE_DIR} /cmake/ modules/tests/test_botan_rfc5649.cpp)
238248 try_run (RUN_AES_KEY_WRAP_PAD COMPILE_RESULT
239249 "${CMAKE_BINARY_DIR} /prebuild_santity_tests" ${testfile}
240250 LINK_LIBRARIES ${CRYPTO_LIBS}
@@ -249,7 +259,7 @@ if(WITH_CRYPTO_BACKEND STREQUAL "botan")
249259 endif ()
250260
251261 # acx_botan_rawpss.m4
252- set (testfile ${CMAKE_SOURCE_DIR} /modules/tests/test_botan_rawpss.cpp)
262+ set (testfile ${CMAKE_SOURCE_DIR} /cmake/ modules/tests/test_botan_rawpss.cpp)
253263 try_run (RUN_RAWPSS COMPILE_RESULT
254264 "${CMAKE_BINARY_DIR} /prebuild_santity_tests" ${testfile}
255265 LINK_LIBRARIES ${CRYPTO_LIBS}
@@ -289,7 +299,7 @@ elseif(WITH_CRYPTO_BACKEND STREQUAL "openssl")
289299
290300 # acx_openssl_ecc.m4
291301 if (ENABLE_ECC)
292- set (testfile ${CMAKE_SOURCE_DIR} /modules/tests/test_openssl_ecc.c)
302+ set (testfile ${CMAKE_SOURCE_DIR} /cmake/ modules/tests/test_openssl_ecc.c)
293303 try_run (RUN_ECC COMPILE_RESULT
294304 "${CMAKE_BINARY_DIR} /prebuild_santity_tests" ${testfile}
295305 LINK_LIBRARIES ${CRYPTO_LIBS}
@@ -310,7 +320,7 @@ elseif(WITH_CRYPTO_BACKEND STREQUAL "openssl")
310320 # acx_openssl_eddsa.m4
311321 if (ENABLE_EDDSA)
312322 # ED25519
313- set (testfile ${CMAKE_SOURCE_DIR} /modules/tests/test_openssl_ed25519.c)
323+ set (testfile ${CMAKE_SOURCE_DIR} /cmake/ modules/tests/test_openssl_ed25519.c)
314324 try_run (RUN_ED25519 COMPILE_RESULT
315325 "${CMAKE_BINARY_DIR} /prebuild_santity_tests" ${testfile}
316326 LINK_LIBRARIES ${CRYPTO_LIBS}
@@ -325,7 +335,7 @@ elseif(WITH_CRYPTO_BACKEND STREQUAL "openssl")
325335 message (FATAL_ERROR ${error_msg} )
326336 endif ()
327337 # ED448
328- set (testfile ${CMAKE_SOURCE_DIR} /modules/tests/test_openssl_ed448.c)
338+ set (testfile ${CMAKE_SOURCE_DIR} /cmake/ modules/tests/test_openssl_ed448.c)
329339 try_run (RUN_ED448 COMPILE_RESULT
330340 "${CMAKE_BINARY_DIR} /prebuild_santity_tests" ${testfile}
331341 LINK_LIBRARIES ${CRYPTO_LIBS}
@@ -344,7 +354,7 @@ elseif(WITH_CRYPTO_BACKEND STREQUAL "openssl")
344354
345355 # acx_openssl_gost.m4
346356 if (ENABLE_GOST)
347- set (testfile ${CMAKE_SOURCE_DIR} /modules/tests/test_openssl_gost.c)
357+ set (testfile ${CMAKE_SOURCE_DIR} /cmake/ modules/tests/test_openssl_gost.c)
348358 try_run (RUN_GOST COMPILE_RESULT
349359 "${CMAKE_BINARY_DIR} /prebuild_santity_tests" ${testfile}
350360 LINK_LIBRARIES ${CRYPTO_LIBS}
@@ -364,7 +374,7 @@ elseif(WITH_CRYPTO_BACKEND STREQUAL "openssl")
364374
365375 # acx_openssl_fips.m4
366376 if (ENABLE_FIPS)
367- set (testfile ${CMAKE_SOURCE_DIR} /modules/tests/test_openssl_fips.c)
377+ set (testfile ${CMAKE_SOURCE_DIR} /cmake/ modules/tests/test_openssl_fips.c)
368378 try_run (RUN_FIPS COMPILE_RESULT
369379 "${CMAKE_BINARY_DIR} /prebuild_santity_tests" ${testfile}
370380 LINK_LIBRARIES ${CRYPTO_LIBS}
@@ -383,7 +393,7 @@ elseif(WITH_CRYPTO_BACKEND STREQUAL "openssl")
383393 endif (ENABLE_FIPS )
384394
385395 # acx_openssl_rfc3349
386- set (testfile ${CMAKE_SOURCE_DIR} /modules/tests/test_openssl_rfc3394.c)
396+ set (testfile ${CMAKE_SOURCE_DIR} /cmake/ modules/tests/test_openssl_rfc3394.c)
387397 try_run (RUN_AES_KEY_WRAP COMPILE_RESULT
388398 "${CMAKE_BINARY_DIR} /prebuild_santity_tests" ${testfile}
389399 LINK_LIBRARIES ${CRYPTO_LIBS}
@@ -398,7 +408,7 @@ elseif(WITH_CRYPTO_BACKEND STREQUAL "openssl")
398408 endif ()
399409
400410 # acx_openssl_rfc5649
401- set (testfile ${CMAKE_SOURCE_DIR} /modules/tests/test_openssl_rfc5649.c)
411+ set (testfile ${CMAKE_SOURCE_DIR} /cmake/ modules/tests/test_openssl_rfc5649.c)
402412 try_run (RUN_AES_KEY_WRAP_PAD COMPILE_RESULT
403413 "${CMAKE_BINARY_DIR} /prebuild_santity_tests" ${testfile}
404414 LINK_LIBRARIES ${CRYPTO_LIBS}
@@ -435,10 +445,6 @@ if(WITH_SQLITE3)
435445
436446 check_include_files (sqlite3.h HAVE_SQLITE3_H )
437447 check_library_exists (sqlite3 sqlite3_prepare_v2 "" HAVE_LIBSQLITE3 )
438- find_program (SQLITE3_COMMAND NAMES sqlite3 )
439- if (SQLITE3_COMMAND MATCHES "-NOTFOUND" )
440- message (FATAL_ERROR "SQLite3: Command was not found" )
441- endif (SQLITE3_COMMAND MATCHES "-NOTFOUND" )
442448else (WITH_SQLITE3 )
443449 message (STATUS "Not including SQLite3 in build" )
444450endif (WITH_SQLITE3 )
@@ -476,14 +482,15 @@ endif(ENABLE_P11_KIT)
476482
477483if (BUILD_TESTS)
478484 # Find CppUnit (equivalent of acx_cppunit.m4)
479- set (CppUnit_FIND_QUIETLY ON )
485+ set (CppUnit_FIND_QUIETLY OFF )
480486 include (FindCppUnit )
481487 if (NOT CPPUNIT_FOUND)
482488 message (FATAL_ERROR "Failed to find CppUnit!" )
483489 endif (NOT CPPUNIT_FOUND )
484490
485491 set (CPPUNIT_INCLUDES ${CPPUNIT_INCLUDE_DIR} )
486492 set (CPPUNIT_LIBS ${CPPUNIT_LIBRARY} )
493+ set (CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARIES} )
487494 message (STATUS "CppUnit: Includes: ${CPPUNIT_INCLUDES} " )
488495 message (STATUS "CppUnit: Libs: ${CPPUNIT_LIBS} " )
489496else (BUILD_TESTS )
0 commit comments