Skip to content

Commit 19150f7

Browse files
author
Tor Didriksen
committed
Bug#25611609 LINK WITH DYNAMIC RUNTIME LIBRARIES ON WINDOWS
Patch for 5.5 and 5.6 Use default runtime libraries on windows, i.e. build with /MD
1 parent 18b3aa1 commit 19150f7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cmake/os/Windows.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -64,6 +64,7 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4)
6464
ENDIF()
6565

6666
IF(MSVC)
67+
OPTION(LINK_STATIC_RUNTIME_LIBRARIES "Link with /MT" OFF)
6768
# Enable debug info also in Release build,
6869
# and create PDB to be able to analyze crashes.
6970
FOREACH(type EXE SHARED MODULE)
@@ -86,7 +87,9 @@ IF(MSVC)
8687
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
8788
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
8889
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
89-
STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
90+
IF(LINK_STATIC_RUNTIME_LIBRARIES)
91+
STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
92+
ENDIF()
9093
STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}")
9194
ENDFOREACH()
9295

0 commit comments

Comments
 (0)