diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2022-08-08 15:40:31 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-08-10 21:17:06 +0000 |
commit | db169494bd95079848fc5afaa48a4b35e490312e (patch) | |
tree | 2a2ac20ae145ff0fe956ef2e6e88f8a8721cfdd4 /cmake | |
parent | 84b0e89d67bd27a68648f7a04118e5018e6e537e (diff) | |
download | qtbase-db169494bd95079848fc5afaa48a4b35e490312e.tar.gz |
CMake: Bail when configuring multiple configurations and plain Ninja
Previously configuration would not error out if you configured Qt
with -DCMAKE_CONFIGURATION_TYPES=RelWithDebInfo;Debug -GNinja
instead you would get an error like
CMake Error at cmake/QtBaseConfigureTests.cmake:51 (message):
Failed to find compiled architecture detection executable at
qtbase/build/config.tests/arch/RelWithDebInfo/architecture_test.exe
Note that Qt code tries to find the arch test in a RelWithDebInfo
directory but due to using single-config Ninja,
CMAKE_CONFIGURATION_TYPES is ignored, and the executable is placed
in a non-config specific folder.
Error out early in such a case, and mention that for multi-config
builds, the Ninja Multi-Config generator should be used.
Change-Id: I0192185123be563671cbe154f968a03b7458e327
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 0ce5c0a9969bc8c763ab50b6271e203c2bcb90de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtSetup.cmake | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index c9d2655bd9..bcb629dcbf 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -59,6 +59,12 @@ elseif(CMAKE_CONFIGURATION_TYPES) message(STATUS "Default build configuration set to '${CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE}'.") endif() + if(CMAKE_GENERATOR STREQUAL "Ninja") + message(FATAL_ERROR + "It's not possible to build multiple configurations with the single config Ninja " + "generator. Consider configuring with -G\"Ninja Multi-Config\" instead of -GNinja." + ) + endif() else() message(STATUS "CMAKE_BUILD_TYPE was set to: '${CMAKE_BUILD_TYPE}'") endif() |