summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/os/Windows.cmake19
1 files changed, 16 insertions, 3 deletions
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake
index 0caa67b20ab..1aa959fc002 100644
--- a/cmake/os/Windows.cmake
+++ b/cmake/os/Windows.cmake
@@ -96,7 +96,8 @@ IF(MSVC)
# Disable mingw based pkg-config found in Strawberry perl
SET(PKG_CONFIG_EXECUTABLE 0 CACHE INTERNAL "")
- SET(MSVC_CRT_TYPE /MT CACHE STRING
+
+ SET(MSVC_CRT_TYPE /MD CACHE STRING
"Runtime library - specify runtime library for linking (/MT,/MTd,/MD,/MDd)"
)
SET(VALID_CRT_TYPES /MTd /MDd /MD /MT)
@@ -106,9 +107,7 @@ IF(MSVC)
IF(MSVC_CRT_TYPE MATCHES "/MD")
# Dynamic runtime (DLLs), need to install CRT libraries.
- SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)# upgrade wizard
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT VCCRT)
- SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS TRUE)
SET(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
IF(MSVC_CRT_TYPE STREQUAL "/MDd")
SET (CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY TRUE)
@@ -278,3 +277,17 @@ ENDIF()
SET(FN_NO_CASE_SENSE 1)
SET(USE_SYMDIR 1)
+
+# Force static C runtime for targets in current directory
+# (useful to get rid of MFC dll's dependency, or in installer)
+MACRO(FORCE_STATIC_CRT)
+ FOREACH(flag
+ CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
+ CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
+ CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
+ CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT
+ CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL
+ )
+ STRING(REGEX REPLACE "/MD[d]?" "/MT" "${flag}" "${${flag}}" )
+ ENDFOREACH()
+ENDMACRO()