diff options
author | Brad King <brad.king@kitware.com> | 2020-10-16 13:19:33 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-10-16 13:19:48 (GMT) |
commit | a11ea1a9ee8cbf53d0d43a80505d200b6edb91ed (patch) | |
tree | c7fe8eb4f2a003296e2755a24673defa01a64a1d | |
parent | b1d9a25f35a22f41b2c1b87725f091936711a28c (diff) | |
parent | b9cb1d324d500e5b26afee33b6cd565e02117319 (diff) | |
download | CMake-a11ea1a9ee8cbf53d0d43a80505d200b6edb91ed.zip CMake-a11ea1a9ee8cbf53d0d43a80505d200b6edb91ed.tar.gz CMake-a11ea1a9ee8cbf53d0d43a80505d200b6edb91ed.tar.bz2 |
Merge topic 'fix-refactor-generator-configs' into release-3.19
b9cb1d324d Fix regression in test/install/package configuration selection
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5381
-rw-r--r-- | Source/cmMakefile.cxx | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CTest/RunCMakeTest.cmake | 11 | ||||
-rw-r--r-- | Tests/RunCMake/CTest/SingleConfig-test-stdout.txt | 8 | ||||
-rw-r--r-- | Tests/RunCMake/CTest/SingleConfig.cmake | 6 |
4 files changed, 27 insertions, 3 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 14ec689..0e4f888 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3401,10 +3401,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); diff --git a/Tests/RunCMake/CTest/RunCMakeTest.cmake b/Tests/RunCMake/CTest/RunCMakeTest.cmake index 62606f8..ffc8f78 100644 --- a/Tests/RunCMake/CTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTest/RunCMakeTest.cmake @@ -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() diff --git a/Tests/RunCMake/CTest/SingleConfig-test-stdout.txt b/Tests/RunCMake/CTest/SingleConfig-test-stdout.txt new file mode 100644 index 0000000..1c39ea1 --- /dev/null +++ b/Tests/RunCMake/CTest/SingleConfig-test-stdout.txt @@ -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$ diff --git a/Tests/RunCMake/CTest/SingleConfig.cmake b/Tests/RunCMake/CTest/SingleConfig.cmake new file mode 100644 index 0000000..7c10e06 --- /dev/null +++ b/Tests/RunCMake/CTest/SingleConfig.cmake @@ -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) |