install(PACKAGE_INFO): Record COMPONENT in global COMPONENTS list

Fixes: #27249
This commit is contained in:
F. Pichot
2025-09-23 10:23:37 -04:00
committed by Brad King
parent 5e7f21328c
commit a20e9569f1
4 changed files with 13 additions and 0 deletions
+5
View File
@@ -2205,6 +2205,11 @@ bool HandlePackageInfoMode(std::vector<std::string> const& args,
cmInstallGenerator::MessageLevel message =
cmInstallGenerator::SelectMessageLevel(helper.Makefile);
// Tell the global generator about any installation component names
// specified
helper.Makefile->GetGlobalGenerator()->AddInstallComponent(
ica.GetComponent());
// Create the export install generator.
helper.Makefile->AddInstallGenerator(
cm::make_unique<cmInstallPackageInfoExportGenerator>(
@@ -0,0 +1 @@
-- COMPONENTS='Unspecified;cps'
@@ -0,0 +1,6 @@
add_library(foo INTERFACE)
install(TARGETS foo EXPORT foo DESTINATION .)
install(PACKAGE_INFO foo DESTINATION cps EXPORT foo COMPONENT cps)
get_cmake_property(components COMPONENTS)
message(STATUS "COMPONENTS='${components}'")
@@ -38,6 +38,7 @@ run_cmake(DependsMultipleDifferentSets)
# Test functionality
run_cmake(Appendix)
run_cmake(Component)
run_cmake(InterfaceProperties)
run_cmake(Metadata)
run_cmake(ProjectMetadata)