From 518b97e674a9e7cdc91bc4048a89eb8a8b37db0b Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Wed, 25 Aug 2021 10:55:45 -0600 Subject: Windows/Ninja: Optimize linker performance The /Zc:inline flag is by default off in the MSVC compiler however when you build with msbuild it adds it to the build flags on its own. Ninja however does not decide on its own to add flags you didn't ask for and was building without this flag. This change explicitly adds the compiler flag so msbuild and ninja builds are once more building with the same build flags leading to smaller .obj files when building with ninja and lightening the workload for the linker. This flag is available starting MSVC 2013 update 2 so does not need to be guarded with version checks. --- build_files/cmake/platform/platform_win32.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'build_files') diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index d44ef691d1b..e3183fe5b7f 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -151,8 +151,8 @@ if(MSVC_CLANG) # Clangs version of cl doesn't support all flags string(APPEND CMAKE_CXX_FLAGS " ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference") else() - string(APPEND CMAKE_CXX_FLAGS " /nologo /J /Gd /MP /EHsc /bigobj") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj") + string(APPEND CMAKE_CXX_FLAGS " /nologo /J /Gd /MP /EHsc /bigobj /Zc:inline") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj /Zc:inline") endif() # X64 ASAN is available and usable on MSVC 16.9 preview 4 and up) -- cgit v1.2.3