mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 10:47:59 +08:00
Merge topic 'fix-refactor-generator-configs'
b9cb1d324d
Fix regression in test/install/package configuration selection
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5381
This commit is contained in:
@@ -3185,10 +3185,9 @@ std::vector<std::string> cmMakefile::GetGeneratorConfigs(
|
||||
GeneratorConfigQuery mode) const
|
||||
{
|
||||
std::vector<std::string> configs;
|
||||
if (this->GetGlobalGenerator()->IsMultiConfig() ||
|
||||
mode == cmMakefile::OnlyMultiConfig) {
|
||||
if (this->GetGlobalGenerator()->IsMultiConfig()) {
|
||||
this->GetDefExpandList("CMAKE_CONFIGURATION_TYPES", configs);
|
||||
} else {
|
||||
} else if (mode != cmMakefile::OnlyMultiConfig) {
|
||||
const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
if (!buildType.empty()) {
|
||||
configs.emplace_back(buildType);
|
||||
|
@@ -27,3 +27,14 @@ function(run_TestfileErrors)
|
||||
run_cmake_command(TestfileErrors-test ${CMAKE_CTEST_COMMAND} -C Debug)
|
||||
endfunction()
|
||||
run_TestfileErrors()
|
||||
|
||||
function(run_SingleConfig)
|
||||
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SingleConfig-build)
|
||||
run_cmake(SingleConfig)
|
||||
set(RunCMake_TEST_NO_CLEAN 1)
|
||||
run_cmake_command(SingleConfig-build ${CMAKE_COMMAND} --build .)
|
||||
run_cmake_command(SingleConfig-test ${CMAKE_CTEST_COMMAND}) # No -C Debug required for single-config.
|
||||
endfunction()
|
||||
if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
|
||||
run_SingleConfig()
|
||||
endif()
|
||||
|
8
Tests/RunCMake/CTest/SingleConfig-test-stdout.txt
Normal file
8
Tests/RunCMake/CTest/SingleConfig-test-stdout.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
^Test project [^
|
||||
]*/Tests/RunCMake/CTest/SingleConfig-build
|
||||
Start 1: SingleConfig
|
||||
1/1 Test #1: SingleConfig \.+ +Passed +[0-9.]+ sec
|
||||
+
|
||||
100% tests passed, 0 tests failed out of 1
|
||||
+
|
||||
Total Test time \(real\) = +[0-9.]+ sec$
|
6
Tests/RunCMake/CTest/SingleConfig.cmake
Normal file
6
Tests/RunCMake/CTest/SingleConfig.cmake
Normal file
@@ -0,0 +1,6 @@
|
||||
include(CTest)
|
||||
|
||||
# This should be ignored by single-config generators.
|
||||
set(CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE INTERNAL "Supported configuration types")
|
||||
|
||||
add_test(NAME SingleConfig COMMAND ${CMAKE_COMMAND} -E echo SingleConfig)
|
Reference in New Issue
Block a user