It's the sqlite3 library that needs threads

This commit is contained in:
Tiger Wang 2021-06-24 20:52:28 +01:00
parent a25ffb56ab
commit b1f67393fd
2 changed files with 7 additions and 7 deletions

View File

@ -279,13 +279,6 @@ else (SQLITECPP_INTERNAL_SQLITE)
endif()
endif (SQLITECPP_INTERNAL_SQLITE)
# Link target with pthread and dl for Unix
if (UNIX)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(SQLiteCpp PUBLIC Threads::Threads ${CMAKE_DL_LIBS})
endif (UNIX)
# Set includes for target and transitive downstream targets
target_include_directories(SQLiteCpp

View File

@ -11,6 +11,13 @@ add_library(sqlite3
sqlite3.h
)
# Link target with pthread and dl for Unix
if (UNIX)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(sqlite3 PUBLIC Threads::Threads ${CMAKE_DL_LIBS})
endif (UNIX)
target_include_directories(sqlite3 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/>)