Permalink
Browse files

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.
  • Loading branch information...
isilkor committed Jan 1, 2019
1 parent 3a8830a commit 15ad4fb6900cde724c198b1869b2eaceb79d16f0
Showing with 1 addition and 0 deletions.
  1. +1 −0 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

0 comments on commit 15ad4fb

Please sign in to comment.