More fixes, should be working now

This commit is contained in:
Pierre Proske 2023-02-06 13:19:57 +11:00
parent 25ab3ce1c2
commit e3fc62dd35
3 changed files with 23 additions and 4 deletions

View File

@ -17,9 +17,14 @@ endif ()
message(STATUS "Using c++ standard c++${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" ON)
if(BUILD_SHARED_LIBS)
add_definitions(-DSQLITECPP_COMPILE_DLL -DSQLITECPP_EXPORT)
if(WIN32)
message("defining SQLITECPP_COMPILE_DLL")
add_definitions("-DSQLITECPP_COMPILE_DLL")
if(SQLITECPP_DLL_EXPORT)
add_definitions("-DSQLITECPP_DLL_EXPORT")
endif()
endif()
endif()
message (STATUS "CMake version: ${CMAKE_VERSION}")

View File

@ -19,11 +19,13 @@
/* Windows DLL export/import */
#if defined(WIN32) && defined(SQLITECPP_COMPILE_DLL)
#ifdef SQLITECPP_EXPORT
#if defined(SQLITECPP_DLL_EXPORT)
#define DLL_API __declspec(dllexport)
#pragma message("Exporting symbols")
#else
#define DLL_API __declspec(dllimport)
#pragma message("Importing symbols")
#endif
#endif
#else
#define DLL_API
#endif

View File

@ -11,6 +11,18 @@ add_library(sqlite3
sqlite3.h
)
if(WIN32)
if(BUILD_SHARED_LIBS)
if(SQLITECPP_DLL_EXPORT)
message("Adding __declspec(dllexport)")
add_definitions("-DSQLITE_API=__declspec(dllexport)")
else()
message("Adding __declspec(dllimport)")
add_definitions("-DSQLITE_API=__declspec(dllimport)")
endif()
endif()
endif()
add_library(SQLite::SQLite3 ALIAS sqlite3)
target_include_directories(sqlite3