CMake: Default to building all configurations with Ninja Multi-Config

Thus we will build both Release and Debug configurations in Coin
when cmake --build . is executed, mimicking qmake's make which
builds both configurations in debug_and_release.

Task-number: QTBUG-80900
Change-Id: If48aca249eb84e690d3f9d51a733b3a25df1f7ca
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-05-14 17:02:59 +02:00
parent 06b148074a
commit fae09465c7
2 changed files with 11 additions and 1 deletions

View File

@ -172,8 +172,15 @@ function(qt_auto_detect_cmake_config)
set(CMAKE_TRY_COMPILE_CONFIGURATION "${QT_MULTI_CONFIG_FIRST_CONFIG}" PARENT_SCOPE)
if(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
# Create build-<config>.ninja files for all specified configurations.
set(CMAKE_CROSS_CONFIGS "all" CACHE STRING "")
# The configuration that will be considered the main one (for example when
# configuring standalone tests with a single-config generator like Ninja).
set(CMAKE_DEFAULT_BUILD_TYPE "${QT_MULTI_CONFIG_FIRST_CONFIG}" CACHE STRING "")
# By default when ninja is called without parameters, it will build all configurations.
set(CMAKE_DEFAULT_CONFIGS "all" CACHE STRING "")
endif()
endif()
endfunction()

View File

@ -381,7 +381,6 @@ function(qt_generate_build_internals_extra_cmake_code)
if(QT_BUILD_STANDALONE_TESTS)
set(CMAKE_BUILD_TYPE \"\${QT_MULTI_CONFIG_FIRST_CONFIG}\" CACHE STRING \"Choose the type of build.\" FORCE)
endif()\n")
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS "${multi_config_specific}")
endif()
if(CMAKE_CROSS_CONFIGS)
@ -392,6 +391,10 @@ endif()\n")
string(APPEND ninja_multi_config_specific
" set(CMAKE_DEFAULT_BUILD_TYPE \"${CMAKE_DEFAULT_BUILD_TYPE}\" CACHE STRING \"\")\n")
endif()
if(CMAKE_DEFAULT_CONFIGS)
string(APPEND ninja_multi_config_specific
" set(CMAKE_DEFAULT_CONFIGS \"${CMAKE_DEFAULT_CONFIGS}\" CACHE STRING \"\")\n")
endif()
if(ninja_multi_config_specific)
qt_wrap_string_in_if_ninja_multi_config(
"${ninja_multi_config_specific}"