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
Change-Id: I6dba589bb59ad69fa07221c657df272ec75c359b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 52e1603e33db9ef29fe1eff8c689d38166d393f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexey Edelev 2020-12-29 14:35:25 +01:00 committed by Qt Cherry-pick Bot
parent 078bd54a38
commit 562fb69d75

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()