From b2ca9fba8b95397cb4ed2aec41f739fcf960ffc6 Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Fri, 21 Nov 2025 15:32:41 -0500 Subject: [PATCH] CPS: Fix exporting definitions in CMake 4.1 Backport commit 37b15eda3b (CPS: Fix exporting definitions, 2025-11-21) to CMake 4.1. Export compile definitions to CPS using the correct attribute name. Fixes: #27403 --- Source/cmExportPackageInfoGenerator.cxx | 2 +- .../ExportPackageInfo/InterfaceProperties-check.cmake | 4 ++-- Tests/RunCMake/ExportPackageInfo/Minimal-check.cmake | 2 +- .../InstallPackageInfo/InterfaceProperties-check.cmake | 4 ++-- Tests/RunCMake/InstallPackageInfo/Minimal-check.cmake | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/cmExportPackageInfoGenerator.cxx b/Source/cmExportPackageInfoGenerator.cxx index b61d6a4f52..a683025c2a 100644 --- a/Source/cmExportPackageInfoGenerator.cxx +++ b/Source/cmExportPackageInfoGenerator.cxx @@ -451,7 +451,7 @@ void cmExportPackageInfoGenerator::GenerateInterfaceCompileDefines( } if (!defines.empty()) { - component["compile_definitions"]["*"] = std::move(defines); + component["definitions"]["*"] = std::move(defines); } } diff --git a/Tests/RunCMake/ExportPackageInfo/InterfaceProperties-check.cmake b/Tests/RunCMake/ExportPackageInfo/InterfaceProperties-check.cmake index faf3e7a61a..fcec61ffe0 100644 --- a/Tests/RunCMake/ExportPackageInfo/InterfaceProperties-check.cmake +++ b/Tests/RunCMake/ExportPackageInfo/InterfaceProperties-check.cmake @@ -14,8 +14,8 @@ expect_array("${component}" 1 "compile_features") expect_value("${component}" "c++23" "compile_features" 0) expect_array("${component}" 1 "compile_flags") expect_value("${component}" "-ffast-math" "compile_flags" 0) -expect_null("${component}" "compile_definitions" "*" "FOO") -expect_value("${component}" "BAR" "compile_definitions" "*" "BAR") +expect_null("${component}" "definitions" "*" "FOO") +expect_value("${component}" "BAR" "definitions" "*" "BAR") expect_array("${component}" 1 "link_directories") expect_value("${component}" "/opt/foo/lib" "link_directories" 0) expect_array("${component}" 1 "link_flags") diff --git a/Tests/RunCMake/ExportPackageInfo/Minimal-check.cmake b/Tests/RunCMake/ExportPackageInfo/Minimal-check.cmake index fc5326a639..3c9993c20b 100644 --- a/Tests/RunCMake/ExportPackageInfo/Minimal-check.cmake +++ b/Tests/RunCMake/ExportPackageInfo/Minimal-check.cmake @@ -8,7 +8,7 @@ expect_value("${content}" "interface" "components" "foo" "type") expect_missing("${content}" "version") expect_missing("${content}" "configurations") expect_missing("${content}" "default_targets") -expect_missing("${content}" "components" "foo" "compile_definitions") +expect_missing("${content}" "components" "foo" "definitions") expect_missing("${content}" "components" "foo" "compile_features") expect_missing("${content}" "components" "foo" "compile_flags") expect_missing("${content}" "components" "foo" "link_directories") diff --git a/Tests/RunCMake/InstallPackageInfo/InterfaceProperties-check.cmake b/Tests/RunCMake/InstallPackageInfo/InterfaceProperties-check.cmake index 365dd80e31..912ce6ba95 100644 --- a/Tests/RunCMake/InstallPackageInfo/InterfaceProperties-check.cmake +++ b/Tests/RunCMake/InstallPackageInfo/InterfaceProperties-check.cmake @@ -14,8 +14,8 @@ expect_array("${component}" 1 "compile_features") expect_value("${component}" "c++23" "compile_features" 0) expect_array("${component}" 1 "compile_flags") expect_value("${component}" "-ffast-math" "compile_flags" 0) -expect_null("${component}" "compile_definitions" "*" "FOO") -expect_value("${component}" "BAR" "compile_definitions" "*" "BAR") +expect_null("${component}" "definitions" "*" "FOO") +expect_value("${component}" "BAR" "definitions" "*" "BAR") expect_array("${component}" 1 "link_directories") expect_value("${component}" "/opt/foo/lib" "link_directories" 0) expect_array("${component}" 1 "link_flags") diff --git a/Tests/RunCMake/InstallPackageInfo/Minimal-check.cmake b/Tests/RunCMake/InstallPackageInfo/Minimal-check.cmake index 8e30fcd739..0281a41f96 100644 --- a/Tests/RunCMake/InstallPackageInfo/Minimal-check.cmake +++ b/Tests/RunCMake/InstallPackageInfo/Minimal-check.cmake @@ -8,7 +8,7 @@ expect_value("${content}" "interface" "components" "foo" "type") expect_missing("${content}" "version") expect_missing("${content}" "configurations") expect_missing("${content}" "default_targets") -expect_missing("${content}" "components" "foo" "compile_definitions") +expect_missing("${content}" "components" "foo" "definitions") expect_missing("${content}" "components" "foo" "compile_features") expect_missing("${content}" "components" "foo" "compile_flags") expect_missing("${content}" "components" "foo" "link_directories")