diff options
author | nir.bar <nir.bar@panel-sw.com> | 2015-12-03 12:33:44 +0200 |
---|---|---|
committer | nir.bar <nir.bar@panel-sw.com> | 2015-12-03 12:33:44 +0200 |
commit | 0d111976e1e5fa297e8811922b2cd4995d5fbb99 (patch) | |
tree | 0bf45c4c2f45b36504408b64badc6cdb1692f7cf | |
parent | 94c08f27c69a1c8ed1549ffc94f46b0f447806b9 (diff) |
Add CMake option on MSVC- STATIC_CRT
-rw-r--r-- | scripts/CMakeLists.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 40a7ab0..c90c78e 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1,6 +1,20 @@ project(pugixml) cmake_minimum_required(VERSION 2.6) +IF (MSVC) + + option(STATIC_CRT "Use static CRT libraries" ON) + + if(STATIC_CRT) + foreach(flag_var + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + if(${flag_var} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + endif(${flag_var} MATCHES "/MD") + endforeach(flag_var) + endif() +ENDIF() option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF) option(BUILD_TESTS "Build tests" OFF) |