Files
CMake/Tests/RunCMake/ExportImport/SharedDep-export.cmake
Brad King 0ebff0d61a export: Restore exclusion of private shared library dependencies from checks
Refactoring in commit 8c65b7042e (cmExportFileGenerator: Simplify
collection of targets missing from export set, 2022-04-11,
v3.24.0-rc1~281^2) accidentally dropped the behavior change from
commit 0ad2a1c181 (Export: Never treat private link libraries as
public package dependencies., 2013-09-24, v3.0.0-rc1~559^2).
Restore the behavior and add a test.

Fixes: #23838
2022-08-15 10:40:03 -04:00

14 lines
539 B
CMake

enable_language(C)
add_library(foo SHARED foo.c)
install(TARGETS foo EXPORT foo)
install(EXPORT foo DESTINATION lib/cmake/foo)
install(FILES foo-config.cmake.in RENAME foo-config.cmake DESTINATION lib/cmake/foo)
add_library(bar SHARED bar.c)
target_link_libraries(bar PRIVATE foo)
# 'foo' only appears in IMPORTED_LINK_DEPENDENT_LIBRARIES, and so is not enforced on import.
install(TARGETS bar EXPORT bar)
install(EXPORT bar DESTINATION lib/cmake/bar)
install(FILES bar-config.cmake.in RENAME bar-config.cmake DESTINATION lib/cmake/bar)