Files
CMake/Tests/RunCMake/install/EXPORT-TargetTwice.cmake
Eugene Shalygin 83d79636bf install(TARGETS): Restore per-export INCLUDES DESTINATION
In commit 55e4753bbb (Refactor cmTargetExport removing
InterfaceIncludeDirecories, 2021-07-20, v3.22.0-rc1~337^2~1) the storage
of `INCLUDES DESTINATION` was moved into each target.  However, a target
may be installed in multiple exports, and their `INCLUDES DESTINATION`
should not be mixed.

Convert the IncludeDirectoriesEntries vector to a map and modify access
function to store the directories lists with respect to cmExportTarget
object. This fixes error when the same target is exported more than once
via different exports and each for consequent export its include
directories list grows. Add a test for this case.

Fixes: #23183
2022-02-09 13:31:26 -05:00

18 lines
334 B
CMake

enable_language(C)
add_library(foo STATIC empty.c)
install(TARGETS foo
EXPORT pkg1
ARCHIVE DESTINATION pkg1/lib
INCLUDES DESTINATION pkg1/inc
)
install(EXPORT pkg1 DESTINATION pkg1)
install(TARGETS foo
EXPORT pkg2
ARCHIVE DESTINATION pkg2/lib
INCLUDES DESTINATION pkg2/inc
)
install(EXPORT pkg2 DESTINATION pkg2)