CMake: Fix Windows resource compiler failure in selftests with MinGW

The MinGW resource compiler fails to handle compile definitions
with multiple values.

When the resource file is compiled as part of the main target rather
than a separate object library, the resource generation rule will
inherit all the compile definitions from the main target.

For the case of tst_selftests this causes errors like

  gcc: error: badxml\: No such file or directory
  gcc: error: benchlibcallgrind\: No such file or directory
  gcc: error: benchlibcounting\: No such file or directory
  gcc: error: benchlibeventcounter\: No such file or directory
  gcc: error: benchliboptions\: No such file or directory

Limit the compile definition to the C++ language only, so the multiple
values are not passed to the resource compiler.

Pick-to: 6.2
Change-Id: Ie53666839272556323b50d79c090f0dc71745d11
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Alexandru Croitor 2021-07-19 11:38:36 +02:00
parent 21782bdc04
commit 3a19c5b2e6

View File

@ -133,7 +133,7 @@ endforeach()
list(JOIN subprograms " " subprograms)
qt_internal_extend_target(tst_selftests
DEFINES
SUBPROGRAMS=${subprograms}
$<$<COMPILE_LANGUAGE:CXX>:SUBPROGRAMS=${subprograms}>
)
# special case end