COIN: Add hack to support debug info with sccache and MSVC

sccache does not support the "/Zi /FS" option for debug information
with MSVC. Optionally replace "/Zi" by "/Z7", which leaves debug
information in the object files and only collects it at link time.
See also qtbase 2354274f39934b94383923834479901106489def.

Change-Id: Id94c2116f3c4192556dbdf8fe82b12ce0a204273
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Eike Ziller
2021-04-23 10:38:22 +02:00
parent 1effc86642
commit 79afbe7f14
5 changed files with 24 additions and 2 deletions
+19
View File
@@ -103,6 +103,25 @@ set(__QTC_LIBRARIES "" CACHE INTERNAL "*** Internal ***")
set(__QTC_EXECUTABLES "" CACHE INTERNAL "*** Internal ***")
set(__QTC_TESTS "" CACHE INTERNAL "*** Internal ***")
# handle SCCACHE hack
# SCCACHE does not work with the /Zi option, which makes each compilation write debug info
# into the same .pdb file - even with /FS, which usually makes this work in the first place.
# Replace /Zi with /Z7, which leaves the debug info in the object files until link time.
# This increases memory usage, disk space usage and linking time, so should only be
# enabled if necessary.
# Must be called after project(...).
function(qtc_handle_sccache_support)
if (MSVC AND WITH_SCCACHE_SUPPORT)
foreach(config DEBUG RELWITHDEBINFO)
foreach(lang C CXX)
set(flags_var "CMAKE_${lang}_FLAGS_${config}")
string(REPLACE "/Zi" "/Z7" ${flags_var} "${${flags_var}}")
set(${flags_var} "${${flags_var}}" PARENT_SCOPE)
endforeach()
endforeach()
endif()
endfunction()
function(append_extra_translations target_name)
if(NOT ARGN)
return()