Skip to content
This repository was archived by the owner on Apr 6, 2019. It is now read-only.

Commit c11a9b9

Browse files
committed
update CMakeList to provide a customization option concerning the MSVC runtime library configuration (issue #47)
1 parent 2e4c20f commit c11a9b9

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

CMakeLists.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,20 @@ IF (WIN32)
4848

4949
# was causing conflics with gtest build
5050
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
51+
52+
IF ("${MSVC_RUNTIME_LIBRARY_CONFIG}" STREQUAL "")
53+
set(MSVC_RUNTIME_LIBRARY_CONFIG "/MT")
54+
ENDIF()
55+
5156
foreach (flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE)
52-
string(REPLACE "/MD" "-MT" ${flag_var} "${${flag_var}}")
57+
IF ("${MSVC_RUNTIME_LIBRARY_CONFIG}" STREQUAL "/MT")
58+
string(REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
59+
ELSEIF ("${MSVC_RUNTIME_LIBRARY_CONFIG}" STREQUAL "/MD")
60+
string(REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}")
61+
ELSE ()
62+
string(REPLACE "/MD" "${MSVC_RUNTIME_LIBRARY_CONFIG}" ${flag_var} "${${flag_var}}")
63+
string(REPLACE "/MT" "${MSVC_RUNTIME_LIBRARY_CONFIG}" ${flag_var} "${${flag_var}}")
64+
ENDIF()
5365
endforeach()
5466

5567
add_definitions(-D_UNICODE)

tacopie

tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ IF (NOT WIN32)
3434
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
3535
ENDIF (NOT WIN32)
3636

37+
3738
###
3839
# includes
3940
###

0 commit comments

Comments
 (0)