Fix compilation error on Windows

When linking static libraries, MSVC's link.exe complains about
the unknown parameter "/INCREMENTAL:NO" and output a lot of warning
messages about this. This doesn't happen when it's linking exes
or dlls.

The situation is a lot more worse when we are using clang-cl.
clang-cl will print some error message like it can't find a
file named "/INCREMENTAL:NO" and just stop compiling. It seems
clang-cl treat unknown parameters as input files.

Fixes: QTBUG-87875
Change-Id: I37ed29de082b0258e81494db54f275417ab42708
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Yuhang Zhao 2020-11-01 10:58:44 +08:00
parent 40495ce75c
commit bbeca236b5

View File

@ -827,7 +827,7 @@ function(qt_internal_set_up_config_optimizations_like_in_qmake)
qt_internal_add_linker_flags(
FLAGS "${flag_value}"
CONFIGS RELEASE RELWITHDEBINFO MINSIZEREL
TYPES ${target_link_types}
TYPES EXE SHARED # when linking static libraries, link.exe can't recognize this parameter, clang-cl will error out.
IN_CACHE)
endif()