cmGlobalGenerator: Only compute build files for all targets

If we're creating generation objects for imported targets only, we
don't need the export sets. Only compute build file generators
if generating for all targets.

Fixes: #23709
This commit is contained in:
Kyle Edwards
2022-07-13 10:22:26 -04:00
parent 529004738a
commit 29c7546a61
3 changed files with 13 additions and 1 deletions

View File

@@ -1361,7 +1361,9 @@ void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes)
this->CheckTargetProperties();
}
this->CreateGeneratorTargets(targetTypes);
this->ComputeBuildFileGenerators();
if (targetTypes == TargetTypes::AllTargets) {
this->ComputeBuildFileGenerators();
}
}
void cmGlobalGenerator::CreateImportedGenerationObjects(

View File

@@ -18,3 +18,4 @@ run_cmake(DependOnDoubleExport)
run_cmake(UnknownExport)
run_cmake(NamelinkOnlyExport)
run_cmake(SeparateNamelinkExport)
run_cmake(TryCompileExport)

View File

@@ -0,0 +1,9 @@
enable_language(CXX)
add_library(interface INTERFACE)
install(TARGETS interface EXPORT export)
export(EXPORT export)
add_library(imported IMPORTED INTERFACE)
try_compile(tc "${CMAKE_CURRENT_BINARY_DIR}/tc" "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" LINK_LIBRARIES imported)