mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
cxxmodules: Do not expect collator install scripts with no CXX_MODULES
Calling `install(EXPORT)` with the `CXX_MODULES_DIRECTORY` parameter leads to installation rules being generated which `include()` CMake scripts that set the `IMPORTED_CXX_MODULES_[CONFIG]` target property for relevant targets. However, these scripts don't get generated for targets in an export set which don't have any C++20 modules. When the installation rules attempt to `include()` the missing scripts, the install fails. Co-authored-by: Brad King <brad.king@kitware.com>
This commit is contained in:
@@ -542,6 +542,12 @@ bool cmExportBuildFileGenerator::GenerateImportCxxModuleConfigTargetInclusion(
|
||||
os.SetCopyIfDifferent(true);
|
||||
|
||||
for (auto const* tgt : this->ExportedTargets) {
|
||||
// Only targets with C++ module sources will have a
|
||||
// collator-generated install script.
|
||||
if (!tgt->HaveCxx20ModuleSources()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
os << "include(\"${CMAKE_CURRENT_LIST_DIR}/target-" << tgt->GetExportName()
|
||||
<< '-' << config << ".cmake\")\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user