Skip to content

Commit da9e17d

Browse files
yxlaocdunn2001
authored andcommitted
allow selection of Windows MSVC runtime
1 parent ac28702 commit da9e17d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ else()
2222
set(JSONCPP_CMAKE_POLICY_VERSION "${JSONCPP_NEWEST_VALIDATED_POLICIES_VERSION}")
2323
endif()
2424
cmake_policy(VERSION ${JSONCPP_CMAKE_POLICY_VERSION})
25+
if(POLICY CMP0091)
26+
cmake_policy(SET CMP0091 NEW)
27+
endif()
2528
#
2629
# Now enumerate specific policies newer than JSONCPP_NEWEST_VALIDATED_POLICIES_VERSION
2730
# that may need to be individually set to NEW/OLD
@@ -85,6 +88,7 @@ option(JSONCPP_WITH_STRICT_ISO "Issue all the warnings demanded by strict ISO C
8588
option(JSONCPP_WITH_PKGCONFIG_SUPPORT "Generate and install .pc files" ON)
8689
option(JSONCPP_WITH_CMAKE_PACKAGE "Generate and install cmake package files" ON)
8790
option(JSONCPP_WITH_EXAMPLE "Compile JsonCpp example" OFF)
91+
option(JSONCPP_STATIC_WINDOWS_RUNTIME "Use static (MT/MTd) Windows runtime" OFF)
8892
option(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." ON)
8993
option(BUILD_STATIC_LIBS "Build jsoncpp_lib as a static library." ON)
9094
option(BUILD_OBJECT_LIBS "Build jsoncpp_lib as a object library." ON)
@@ -123,6 +127,9 @@ if(MSVC)
123127
# Only enabled in debug because some old versions of VS STL generate
124128
# unreachable code warning when compiled in release configuration.
125129
add_compile_options($<$<CONFIG:Debug>:/W4>)
130+
if (JSONCPP_STATIC_WINDOWS_RUNTIME)
131+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
132+
endif()
126133
endif()
127134

128135
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")

0 commit comments

Comments
 (0)