CMake: Add proactive check of generator multi-config capabilities

Add explicit error, if multi-config build is requested, but selected
generator doesn't support it.

Fixes: QTBUG-88287
Pick-to: 6.0
Change-Id: I6dba589bb59ad69fa07221c657df272ec75c359b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexey Edelev 2020-12-29 14:35:25 +01:00
parent 01708a44de
commit 52e1603e33

View File

@ -774,6 +774,16 @@ if(NOT generator AND auto_detect_generator)
endif()
endif()
endif()
if(multi_config
AND NOT "${generator}" STREQUAL "Xcode"
AND NOT "${generator}" STREQUAL "Ninja Multi-Config"
AND NOT "${generator}" MATCHES "^Visual Studio")
message(FATAL_ERROR "Multi-config build is only supported by Xcode, Ninja Multi-Config and \
Visual Studio generators. Current generator is \"${generator}\".
Note: Use '-cmake-generator <generator name>' option to specify the generator manually.")
endif()
if(generator)
push(-G "${generator}")
endif()