Skip to content

Commit 521181c

Browse files
committed
Added option to configure static vs shared MSVC runtime
1 parent a99d48d commit 521181c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
1515
message (STATUS "CMake version: ${CMAKE_VERSION}")
1616
message (STATUS "Project version: ${PROJECT_VERSION}")
1717

18+
option(SQLITECPP_USE_STATIC_RUNTIME "Use MSVC static runtime (default for internal googletest)." ON)
19+
1820
# Define useful variables to handle OS differences:
1921
if (WIN32)
2022
set(DEV_NULL "NUL")
@@ -28,14 +30,14 @@ if (MSVC)
2830
set(CPPCHECK_ARG_TEMPLATE "--template=vs")
2931
# disable Visual Studio warnings for fopen() used in the example
3032
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
31-
# Flags for linking with multithread static C++ runtime, required by googletest
32-
if (SQLITECPP_BUILD_TESTS)
33-
message(STATUS "Linking against multithread static C++ runtime for unit tests with googletest")
33+
# Flags for linking with multithread static C++ runtime, required by internal googletest
34+
if (SQLITECPP_USE_STATIC_RUNTIME)
35+
message(STATUS "Linking against multithread static C++ runtime")
3436
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
3537
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
3638
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
3739
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
38-
endif (SQLITECPP_BUILD_TESTS)
40+
endif (SQLITECPP_USE_STATIC_RUNTIME)
3941
# MSVC versions prior to 2015 are not supported anymore by SQLiteC++ 3.x
4042
if (MSVC_VERSION LESS 1900) # OR MSVC_TOOLSET_VERSION LESS 140)
4143
message(ERROR "Visual Studio prior to 2015 is not supported anymore.")

0 commit comments

Comments
 (0)