Fix clang LTCG config on Windows

To enable LTCG, clang-cl.exe need "-flto" instead of "-GL". But if you
enabled LTO, the lib tool will have to change to "llvm-lib.exe" and the
link tool also need to change to "lld-link.exe", because msvc linker
will see these lib files as corrupted files. Leave QMAKE_LFLAGS_LTCG
empty because lld-link doesn't need any additional parameters.

Fixes: QTBUG-72402
Change-Id: Ia34d98bd1ad919d542ea3eac83944bf8c40ce0cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Yuhang Zhao 2018-12-11 00:52:36 +08:00
parent 8571abc097
commit b34143f8a1

View File

@ -15,6 +15,14 @@ QMAKE_CFLAGS += -Wno-microsoft-enum-value
QMAKE_CXXFLAGS += -Wno-microsoft-enum-value
QMAKE_LINK = lld-link
QMAKE_LIB = llvm-lib /NOLOGO
QMAKE_CFLAGS_LTCG = -flto
QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
# Leave QMAKE_LFLAGS_LTCG empty because lld-link doesn't need any additional parameters
QMAKE_LFLAGS_LTCG =
# Precompiled headers are not supported yet by clang
CONFIG -= precompile_header