Merge topic 'target-empty-imported-configs'

23f1cb47c7 cmTarget: Don't crash on empty IMPORTED_CONFIGURATIONS

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12470
This commit is contained in:
Brad King
2026-09-03 09:16:05 -04:00
committed by Kitware Robot
5 changed files with 18 additions and 1 deletions
+2 -1
View File
@@ -3707,7 +3707,8 @@ bool cmTarget::GetMappedConfigNew(std::string desiredConfig, cmValue& loc,
}
// Get imported configurations, if specified.
if (cmValue iconfigs = this->GetProperty("IMPORTED_CONFIGURATIONS")) {
cmValue const iconfigs = this->GetProperty("IMPORTED_CONFIGURATIONS");
if (!iconfigs.IsEmpty()) {
cmList const availableConfigs{ cmSystemTools::UpperCase(*iconfigs) };
if (!mappedConfigs.empty()) {
@@ -0,0 +1,6 @@
(CMake Error in CMakeLists.txt:
IMPORTED_LOCATION not set for imported target "imported"( configuration
"[A-Za-z]+")?\.
)+
CMake Generate step failed\. Build files cannot be regenerated correctly\.
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 4.4)
project(empty_imported_configuration NONE)
add_library(imported UNKNOWN IMPORTED)
set_property(TARGET imported PROPERTY IMPORTED_CONFIGURATIONS "")
file(GENERATE OUTPUT out.txt CONTENT "$<TARGET_FILE:imported>")
@@ -184,6 +184,8 @@ run_cmake_build(CMP0200-NEW)
run_cmake_build(CMP0199-NEW+CMP0200-NEW)
run_cmake(Empty-IMPORTED_CONFIGURATIONS)
set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0085:STRING=OLD)
run_cmake(CMP0085-OLD)
unset(RunCMake_TEST_OPTIONS)