Skip to content

Commit d6d9270

Browse files
committed
try to fix sqlcipher test
1 parent 4b92d31 commit d6d9270

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

CMakeLists.txt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0)
22
OPTION(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)
66
set (CMAKE_CXX_STANDARD 14)
77

88
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
@@ -26,12 +26,9 @@ find_package(sqlite3 CONFIG REQUIRED)
2626
set(TEST_SOURCE_DIR ${CMAKE_SOURCE_DIR}/tests)
2727
file(GLOB TEST_SOURCES ${TEST_SOURCE_DIR}/*.cc)
2828

29-
message(STATUS ${ENABLE_SQLCIPHER_TESTS})
3029
IF(NOT ENABLE_SQLCIPHER_TESTS)
3130
list(REMOVE_ITEM TEST_SOURCES ${TEST_SOURCE_DIR}/sqlcipher.cc)
3231
ENDIF(NOT ENABLE_SQLCIPHER_TESTS)
33-
message(STATUS ${TEST_SOURCES})
34-
message(STATUS ${TEST_SOURCE_DIR}/sqlcipher.cc)
3532

3633
enable_testing()
3734

@@ -40,10 +37,11 @@ target_include_directories(sqlite_modern_cpp INTERFACE hdr/)
4037

4138
add_executable(tests ${TEST_SOURCES})
4239
target_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

4846
ParseAndAddCatchTests(tests)
4947

0 commit comments

Comments
 (0)