@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
22OPTION (ENABLE_SQLCIPHER_TESTS "enable sqlchipher test" )
33
44# Creates the file compile_commands.json in the build directory.
5- SET ( CMAKE_EXPORT_COMPILE_COMMANDS ON )
5+ SET (CMAKE_EXPORT_COMPILE_COMMANDS ON )
66set (CMAKE_CXX_STANDARD 14)
77
88set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR} /cmake" )
@@ -26,12 +26,9 @@ find_package(sqlite3 CONFIG REQUIRED)
2626set (TEST_SOURCE_DIR ${CMAKE_SOURCE_DIR} /tests)
2727file (GLOB TEST_SOURCES ${TEST_SOURCE_DIR} /*.cc)
2828
29- message (STATUS ${ENABLE_SQLCIPHER_TESTS} )
3029IF (NOT ENABLE_SQLCIPHER_TESTS)
3130 list (REMOVE_ITEM TEST_SOURCES ${TEST_SOURCE_DIR} /sqlcipher.cc)
3231ENDIF (NOT ENABLE_SQLCIPHER_TESTS)
33- message (STATUS ${TEST_SOURCES} )
34- message (STATUS ${TEST_SOURCE_DIR} /sqlcipher.cc)
3532
3633enable_testing ()
3734
@@ -40,10 +37,11 @@ target_include_directories(sqlite_modern_cpp INTERFACE hdr/)
4037
4138add_executable (tests ${TEST_SOURCES} )
4239target_include_directories (tests INTERFACE ${SQLITE3_INCLUDE_DIRS} )
43- target_link_libraries (tests Catch::Catch sqlite_modern_cpp sqlite3::sqlite3)
44- IF (ENABLE_SQLCIPHER_TESTS)
45- set_target_properties (tests PROPERTIES COMPILE_FLAGS '-lsqlcipher')
46- ENDIF (ENABLE_SQLCIPHER_TESTS)
40+ if (ENABLE_SQLCIPHER_TESTS)
41+ target_link_libraries (tests Catch::Catch sqlite_modern_cpp sqlite3::sqlite3 -lsqlcipher)
42+ else ()
43+ target_link_libraries (tests Catch::Catch sqlite_modern_cpp sqlite3::sqlite3)
44+ endif ()
4745
4846ParseAndAddCatchTests(tests)
4947
0 commit comments