From 15ad4fb6900cde724c198b1869b2eaceb79d16f0 Mon Sep 17 00:00:00 2001 From: Nicolas Hake Date: Tue, 1 Jan 2019 21:26:30 +0100 Subject: [PATCH] MSVC: Disable incremental linking LTCG doesn't work with incremental linking, but unless we explicitly disable incremental linking, CMake tells the linker to attempt it. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b906036b..d65e2ae04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,6 +168,7 @@ if(MSVC) # Enable LTCG for release builds set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Ob2 /GL") set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Ob2 /GL") + add_linker_flags(optimized MODULES exe shared FLAGS "/INCREMENTAL:NO") add_linker_flags(optimized MODULES exe shared static FLAGS "/LTCG:incremental") # do not link the release CRT in debug builds