From 0d111976e1e5fa297e8811922b2cd4995d5fbb99 Mon Sep 17 00:00:00 2001 From: "nir.bar" Date: Thu, 3 Dec 2015 12:33:44 +0200 Subject: Add CMake option on MSVC- STATIC_CRT --- scripts/CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'scripts') 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) -- cgit v1.2.3