Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ option(sqlite3_ENABLE_RTREE "Include rtree support" ON)
option(sqlite3_ENABLE_SESSION "Enable the session extension" OFF)
option(sqlite3_OMIT_DEPRECATED "Omit deprecated stuff" ON)

if (sqlite3_BUILD_SHARED_LIBS)
if(sqlite3_BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
else()
set(BUILD_SHARED_LIBS OFF)
Expand All @@ -57,12 +57,20 @@ FetchContent_MakeAvailable(sqlite3_ext)

target_include_directories(SQLite3
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${sqlite3_ext_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${sqlite3_ext_SOURCE_DIR}>
PRIVATE
${sqlite3_ext_SOURCE_DIR}
${sqlite3_ext_SOURCE_DIR}
)

if(BUILD_SHARED_LIBS)
if(WIN32)
target_compile_definitions(SQLite3 PRIVATE "SQLITE_API=__declspec(dllexport)")
else()
target_compile_definitions(SQLite3 PRIVATE "SQLITE_API=__attribute__((visibility(\"default\")))")
endif()
endif()

function(check_and_define items check_function)
foreach(item ${${items}})
string(TOUPPER ${item} item_upper)
Expand Down Expand Up @@ -96,7 +104,7 @@ if(STRERROR_R)
#include <string.h>
int main() {
return (strerror_r(0, (char*)0, 0) == (char*)0);
}" HAVE_GNU_STRERROR_R)
}" HAVE_GNU_STRERROR_R)
if(HAVE_GNU_STRERROR_R)
target_compile_definitions(SQLite3 PRIVATE STRERROR_R_CHAR_P=1)
endif()
Expand Down