aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaios <naios-dev@live.de>2016-03-17 16:22:50 +0100
committerNaios <naios-dev@live.de>2016-03-18 14:28:01 +0100
commitfbc23c0713e98cb16d601c64e2e3e2a7716d2ab8 (patch)
tree6966e44267a921fdbaed8a4e24d80a090e7581fa
parentbf773ccc417b47d01502c8151cea6188e33e16aa (diff)
CMake: Disable incremental linking in msvc debug builds
* Requested by Shauren
-rw-r--r--cmake/compiler/msvc/settings.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmake/compiler/msvc/settings.cmake b/cmake/compiler/msvc/settings.cmake
index be8028da024..8af8033d809 100644
--- a/cmake/compiler/msvc/settings.cmake
+++ b/cmake/compiler/msvc/settings.cmake
@@ -84,3 +84,15 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm500")
# 'function' : member function does not override any base class virtual member function
# 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /we4263 /we4264")
+
+# Disable incremental linking in debug builds.
+# To prevent linking getting stuck (which might be fixed in a later VS version).
+macro(DisableIncrementalLinking variable)
+ string(REGEX REPLACE "/INCREMENTAL *" "" ${variable} "${${variable}}")
+ set(${variable} "${${variable}} /INCREMENTAL:NO")
+endmacro()
+
+DisableIncrementalLinking(CMAKE_EXE_LINKER_FLAGS_DEBUG)
+DisableIncrementalLinking(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO)
+DisableIncrementalLinking(CMAKE_SHARED_LINKER_FLAGS_DEBUG)
+DisableIncrementalLinking(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO)