mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 00:11:07 -06:00
install(EXPORT): Fix exporting target w/ source named using CONFIG genex
Fixes: #21203
This commit is contained in:
@@ -565,11 +565,9 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
|
||||
ifaceProperties);
|
||||
|
||||
if (gtarget->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
|
||||
getCompatibleInterfaceProperties(gtarget, ifaceProperties, "");
|
||||
|
||||
std::vector<std::string> configNames =
|
||||
gtarget->Target->GetMakefile()->GetGeneratorConfigs(
|
||||
cmMakefile::ExcludeEmptyConfig);
|
||||
cmMakefile::IncludeEmptyConfig);
|
||||
|
||||
for (std::string const& cn : configNames) {
|
||||
getCompatibleInterfaceProperties(gtarget, ifaceProperties, cn);
|
||||
|
||||
@@ -669,3 +669,18 @@ endif()
|
||||
# IMPORTED_LINK_INTERFACE_LANGUAGES entries should not be targets.
|
||||
add_library(C INTERFACE)
|
||||
add_library(CXX INTERFACE)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# test export of targets built from sources named using $<CONFIG> generator-expression
|
||||
# FIXME: Enable test on Xcode generator when it supports per-config sources.
|
||||
if(NOT XCODE)
|
||||
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_$<CONFIG>.cpp" CONTENT "// content")
|
||||
add_library(testStaticFromGeneratedSource STATIC)
|
||||
target_sources(testStaticFromGeneratedSource PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/Generated_$<CONFIG>.cpp")
|
||||
|
||||
add_library(testLibFromGeneratedSource SHARED empty.cpp)
|
||||
target_link_libraries(testLibFromGeneratedSource PRIVATE testStaticFromGeneratedSource)
|
||||
|
||||
install(TARGETS testLibFromGeneratedSource EXPORT testLibFromGeneratedSource_Export)
|
||||
install(EXPORT testLibFromGeneratedSource_Export DESTINATION lib)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user