diff --git a/CMakeLists.txt b/CMakeLists.txt index b651f472..7123a570 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -240,13 +240,6 @@ if (SQLITECPP_INTERNAL_SQLITE) add_subdirectory(sqlite3) target_link_libraries(SQLiteCpp PUBLIC sqlite3) else (SQLITECPP_INTERNAL_SQLITE) - find_package (SQLite3 REQUIRED) - message(STATUS "Link to sqlite3 system library") - target_link_libraries(SQLiteCpp PUBLIC SQLite::SQLite3) - if(SQLite3_VERSION VERSION_LESS "3.19") - set_target_properties(SQLiteCpp PROPERTIES COMPILE_FLAGS "-DSQLITECPP_HAS_MEM_STRUCT") - endif() - # When using the SQLite codec, we need to link against the sqlcipher lib & include # So this gets the lib & header, and links/includes everything if(SQLITE_HAS_CODEC) @@ -284,6 +277,13 @@ else (SQLITECPP_INTERNAL_SQLITE) target_include_directories(SQLiteCpp PRIVATE "${sqlcipher_INCLUDE_DIR}/sqlcipher") target_link_libraries(SQLiteCpp PRIVATE ${sqlcipher_LIBRARY}) endif() + else() + find_package (SQLite3 REQUIRED) + message(STATUS "Link to sqlite3 system library") + target_link_libraries(SQLiteCpp PUBLIC SQLite::SQLite3) + if(SQLite3_VERSION VERSION_LESS "3.19") + set_target_properties(SQLiteCpp PROPERTIES COMPILE_FLAGS "-DSQLITECPP_HAS_MEM_STRUCT") + endif() endif() endif (SQLITECPP_INTERNAL_SQLITE)