summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAdam Szmigin <smidge@xsco.net>2020-10-06 14:24:06 +0100
committerGitHub <noreply@github.com>2020-10-06 14:24:06 +0100
commitfe21c4d6dae9f14a7a2097dce0d7b5a7d84178d5 (patch)
tree3680042c5f8a0981db070c21b76c26f98848bd16 /CMakeLists.txt
parent2fb8d7e1811090bcea1ab204407936b408fa5ec3 (diff)
parent9d1fbbbc96705410a662af5858ca4df8a40796e9 (diff)
Merge pull request #31 from xsco/fix/msvc-static-lib-build
Fix static builds on MSVC
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt28
1 files changed, 16 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 06f992e..22e0e25 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,7 @@
# The meson/ninja build should be preferred in all other cases.
#
cmake_minimum_required(VERSION 3.13)
-project(libdjinterop VERSION 0.14.1)
+project(libdjinterop VERSION 0.14.2)
# Require C++17
set(CMAKE_CXX_STANDARD 17)
@@ -22,14 +22,6 @@ option(SYSTEM_SQLITE "Use system installation of SQLite" ON)
# Require zlib >= 1.2.8
find_package(ZLIB 1.2.8 REQUIRED)
-# Generate config.hpp based on build-time environment.
-include(CheckIncludeFileCXX)
-CHECK_INCLUDE_FILE_CXX(optional DJINTEROP_STD_OPTIONAL)
-CHECK_INCLUDE_FILE_CXX(experimental/optional DJINTEROP_STD_EXPERIMENTAL_OPTIONAL)
-configure_file(
- include/djinterop/config.hpp.in
- include/djinterop/config.hpp)
-
add_library(
djinterop
src/djinterop/impl/crate_impl.cpp
@@ -61,9 +53,20 @@ add_library(
src/djinterop/transaction_guard.cpp
src/djinterop/util.cpp)
-target_compile_definitions(
- djinterop PUBLIC
- DJINTEROP_SOURCE)
+target_compile_definitions(djinterop PUBLIC DJINTEROP_SOURCE)
+
+get_target_property(djinterop_library_type djinterop TYPE)
+if(djinterop_library_type STREQUAL "STATIC_LIBRARY")
+ set(DJINTEROP_STATIC ON)
+endif()
+
+# Generate config.hpp based on build-time environment.
+include(CheckIncludeFileCXX)
+CHECK_INCLUDE_FILE_CXX(optional DJINTEROP_STD_OPTIONAL)
+CHECK_INCLUDE_FILE_CXX(experimental/optional DJINTEROP_STD_EXPERIMENTAL_OPTIONAL)
+configure_file(
+ include/djinterop/config.hpp.in
+ include/djinterop/config.hpp)
target_include_directories(
djinterop PUBLIC
@@ -76,6 +79,7 @@ target_link_libraries(
djinterop PUBLIC
${ZLIB_LIBRARIES})
+
if(SYSTEM_SQLITE)
# Search for system installation of SQLite and use that.
find_package(SQLite3 3.11.0 REQUIRED)