summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-12-30 23:54:58 +0300
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-12-30 23:54:58 +0300
commit6a22a28730c0c621d432197627f3d6c43d9b11ee (patch)
treef8d2d71e0a247c6032cd27424b91c5e675eb2d0f
parent1bcf12402e0306606705c3f68ba6b325e89352cd (diff)
parent3dadebf10e578468b04f00236b0af5961c4c58a0 (diff)
Merge pull request #70 from nirbar/master
scripts: Allow linking static CRT libraries on Windows Use the solution from CMake FAQ to specify correct command-line arguments.
-rw-r--r--scripts/CMakeLists.txt14
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)