Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Tests/CMakeCommands/target_link_libraries/SubDirA/CMakeLists.txt
3156 views
1
add_executable(SubDirA SubDirA.c)
2
3
# Link to a target imported in this directory that would not normally
4
# be visible to the directory in which TopDir is defined.
5
target_link_libraries(TopDir PUBLIC SameNameImported)
6
# Do the same through an interface library in the top.
7
target_link_libraries(TopDirInterface INTERFACE SameNameImported2)
8
9
# Link SubDirA to a target imported in this directory that has the same
10
# name as a target imported in SubDirB's directory. SubDirB will also
11
# tell us to link its copy. At compile time we verify both are linked.
12
target_link_libraries(SubDirA PRIVATE SameNameImported)
13
14
# Import a target with the same name as a target imported in SubDirB.
15
# Distinguish this copy by having a unique usage requirement.
16
add_library(SameNameImported IMPORTED INTERFACE)
17
target_compile_definitions(SameNameImported INTERFACE DEF_SameNameImportedSubDirA)
18
add_library(SameNameImported2 INTERFACE IMPORTED)
19
target_compile_definitions(SameNameImported2 INTERFACE DEF_SameNameImported2SubDirA)
20
21