From e6f2c000e68e124fde84766affd87a1ca9fd97a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Rombauts?= Date: Fri, 18 Aug 2023 12:29:54 +0200 Subject: [PATCH] Declare BUILD_SHARED_LIBS option for discoverability BUILD_SHARED_LIBS is a standard CMake variable, but we declare it explicitly to make it prominent --- CMakeLists.txt | 8 ++++++-- sqlite3/CMakeLists.txt | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51c1eb6..ea3eacf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,9 @@ message (STATUS "Project version: ${PROJECT_VERSION}") option(SQLITECPP_BUILD_TESTS "Build and run tests." OFF) +# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make it prominent +option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF) + # Define useful variables to handle OS differences: if (WIN32) set(DEV_NULL "NUL") @@ -230,8 +233,9 @@ if (SQLITE_USE_LEGACY_STRUCT) target_compile_definitions(SQLiteCpp PUBLIC SQLITE_USE_LEGACY_STRUCT) endif (SQLITE_USE_LEGACY_STRUCT) -if(BUILD_SHARED_LIBS) - if(WIN32) +if (BUILD_SHARED_LIBS) + if (WIN32) + message(STATUS "Build shared libraries (DLLs).") target_compile_definitions(SQLiteCpp PUBLIC "SQLITECPP_COMPILE_DLL") target_compile_definitions(SQLiteCpp PRIVATE "SQLITECPP_DLL_EXPORT") endif() diff --git a/sqlite3/CMakeLists.txt b/sqlite3/CMakeLists.txt index c79743c..0695c71 100644 --- a/sqlite3/CMakeLists.txt +++ b/sqlite3/CMakeLists.txt @@ -11,8 +11,8 @@ add_library(sqlite3 sqlite3.h ) -if(WIN32) - if(BUILD_SHARED_LIBS) +if (WIN32) + if (BUILD_SHARED_LIBS) add_definitions("-DSQLITE_API=__declspec(dllexport)") endif() endif()