Skip to content

Commit 741078b

Browse files
committed
Replace the set() of "/MT" to REPLACE "/MD" "/MT"
inspired from Zlib licensed glfw https://github.com/glfw/glfw/blob/master/CMakeLists.txt
1 parent 7a1649c commit 741078b

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

CMakeLists.txt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,25 @@ if (MSVC)
3636
# disable Visual Studio warnings for fopen() used in the example
3737
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
3838
# Flags for linking with multithread static C++ runtime, required by internal googletest
39+
# inspired from Zlib licensed glfw https://github.com/glfw/glfw/blob/master/CMakeLists.txt
3940
option(SQLITECPP_USE_STATIC_RUNTIME "Use MSVC static runtime (default for internal googletest)." ${SQLITECPP_BUILD_TESTS})
4041
if (SQLITECPP_USE_STATIC_RUNTIME)
4142
message(STATUS "Linking against multithread static C++ runtime")
42-
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
43-
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
44-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
45-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
43+
foreach (flag CMAKE_C_FLAGS
44+
CMAKE_C_FLAGS_DEBUG
45+
CMAKE_C_FLAGS_RELEASE
46+
CMAKE_C_FLAGS_MINSIZEREL
47+
CMAKE_C_FLAGS_RELWITHDEBINFO
48+
CMAKE_CXX_FLAGS
49+
CMAKE_CXX_FLAGS_DEBUG
50+
CMAKE_CXX_FLAGS_RELEASE
51+
CMAKE_CXX_FLAGS_MINSIZEREL
52+
CMAKE_CXX_FLAGS_RELWITHDEBINFO)
53+
54+
string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
55+
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
56+
57+
endforeach()
4658
endif (SQLITECPP_USE_STATIC_RUNTIME)
4759
# MSVC versions prior to 2015 are not supported anymore by SQLiteC++ 3.x
4860
if (MSVC_VERSION LESS 1900) # OR MSVC_TOOLSET_VERSION LESS 140)

0 commit comments

Comments
 (0)