mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-12 12:15:34 +00:00
CPS provides "default targets" as a user convenience which can be linked by specifying only the package name. CMake implements this via a utility `INTERFACE` target. However, because it is not namespaced, this is not a valid requirement, which prevents exporting anything linking to this target to CPS. Work around this by introducing a new (internal) target property which replaces a target with its link interface targets at export time.
13 lines
249 B
CMake
13 lines
249 B
CMake
find_package(
|
|
foo REQUIRED CONFIG
|
|
NO_DEFAULT_PATH
|
|
PATHS ${CMAKE_CURRENT_LIST_DIR}
|
|
)
|
|
|
|
add_library(bar INTERFACE)
|
|
target_link_libraries(bar INTERFACE foo)
|
|
|
|
install(TARGETS bar EXPORT bar)
|
|
export(EXPORT bar)
|
|
export(PACKAGE_INFO bar EXPORT bar)
|