CPS/c++modules: Fix manifest paths from separate install dirs

Fixes: #28011
This commit is contained in:
Vito Gamberini committed 2026-09-24 14:04:17 -04:00
1 parent abf5a58ecc
commit 115a779a4b
3 files changed
+27 -17

No files matched your search

+17 -12
View File
@@ -32,6 +32,7 @@
#include "cmInstallFileSetGenerator.h"
#include "cmInstallGenerator.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmOutputConverter.h"
@@ -109,12 +110,14 @@ TdiSourceInfo CollationInformationSources(cmGeneratorTarget const* gt,
auto files_per_dirs = file_set->GetFiles(context, gt);
Json::Value fs_dest = Json::nullValue;
for (auto const& ig : gt->Makefile->GetInstallGenerators()) {
if (auto const* fsg =
dynamic_cast<cmInstallFileSetGenerator const*>(ig.get())) {
if (fsg->GetTarget() == gt && fsg->GetFileSet() == file_set) {
fs_dest = fsg->GetDestination(config);
continue;
// The install rule may be in a different directory than the target.
for (auto const& lg : gt->GetGlobalGenerator()->GetLocalGenerators()) {
for (auto const& ig : lg->GetMakefile()->GetInstallGenerators()) {
if (auto const* fsg =
dynamic_cast<cmInstallFileSetGenerator const*>(ig.get())) {
if (fsg->GetTarget() == gt && fsg->GetFileSet() == file_set) {
fs_dest = fsg->GetDestination(config);
}
}
}
}
@@ -229,12 +232,14 @@ Json::Value CollationInformationBmiInstallation(cmGeneratorTarget const* gt,
std::string const& config)
{
cmInstallCxxModuleBmiGenerator const* bmi_gen = nullptr;
for (auto const& ig : gt->Makefile->GetInstallGenerators()) {
if (auto const* bmig =
dynamic_cast<cmInstallCxxModuleBmiGenerator const*>(ig.get())) {
if (bmig->GetTarget() == gt) {
bmi_gen = bmig;
continue;
// The install rule may be in a different directory than the target.
for (auto const& lg : gt->GetGlobalGenerator()->GetLocalGenerators()) {
for (auto const& ig : lg->GetMakefile()->GetInstallGenerators()) {
if (auto const* bmig =
dynamic_cast<cmInstallCxxModuleBmiGenerator const*>(ig.get())) {
if (bmig->GetTarget() == gt) {
bmi_gen = bmig;
}
}
}
}
@@ -11,7 +11,8 @@ install(TARGETS export_sepdir
install(EXPORT CXXModules
NAMESPACE CXXModules::
DESTINATION "lib/cmake/export_sepdir"
FILE "export_sepdir-targets.cmake")
FILE "export_sepdir-targets.cmake"
CXX_MODULES_DIRECTORY "export_sepdir-cxx-modules")
install(PACKAGE_INFO "export_sepdir_cps"
EXPORT CXXModules
DESTINATION "lib/cmake/export_sepdir_cps"
@@ -12,10 +12,14 @@ function(test_target target)
endif ()
get_property(modules TARGET ${target}
PROPERTY "IMPORTED_CXX_MODULES_NOCONFIG")
if (modules STREQUAL "")
message(SEND_ERROR
"Expected non-empty property value for IMPORTED_CXX_MODULES_NOCONFIG")
PROPERTY IMPORTED_CXX_MODULES_DEBUG)
set(expected_modules "importable=${expected_dir}/importable.cxx")
if (NOT modules STREQUAL "${expected_modules}")
message(FATAL_ERROR
"Incorrect exported modules in ${target}:\n"
" ${modules}\n"
"does not match:\n"
" ${expected_modules}")
endif ()
endfunction()