File: CMakeLists.txt

package info (click to toggle)
cmake 4.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 152,336 kB
  • sloc: ansic: 403,896; cpp: 303,920; sh: 4,105; python: 3,583; yacc: 3,106; lex: 1,279; f90: 538; asm: 471; lisp: 375; cs: 270; java: 266; fortran: 239; objc: 215; perl: 213; xml: 198; makefile: 111; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (40 lines) | stat: -rw-r--r-- 1,356 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
project(Direct)

add_executable(link_transitive_direct_exe ../empty.c)
add_library(transitive_direct_lib STATIC ../empty.c)
add_library(inject_direct_lib INTERFACE)
add_library(inject_direct_lib_impl OBJECT other.c)

set(head_targets
  EXECUTABLE
  SHARED_LIBRARY
  MODULE_LIBRARY
)
set_property(TARGET inject_direct_lib PROPERTY INTERFACE_LINK_LIBRARIES_DIRECT
  # Skip intermediate targets, only apply to the head target
  "$<$<IN_LIST:$<TARGET_PROPERTY:TYPE>,${head_targets}>:inject_direct_lib_impl>"
)

target_link_libraries(link_transitive_direct_exe
  # Link interfaces are not supported for executables that do not export
  # symbols, so even though this specifies PUBLIC here, the direct dependencies
  # should show up as private.
  PUBLIC
    transitive_direct_lib
)

# This is not an executable, so the direct dependency types should follow the
# keywords specified here.
target_link_libraries(transitive_direct_lib
  PUBLIC
    inject_direct_lib
  INTERFACE
    -lm  # Doesn't need to exist, just verifying fragments in directDependencies
)

cmake_policy(SET CMP0131 NEW)
add_library(usage_lib STATIC ../empty.c)
add_executable(link_usage_exe ../empty.c)
add_executable(compile_usage_exe ../empty.c)
target_link_libraries(link_usage_exe PRIVATE $<LINK_ONLY:usage_lib>)
target_link_libraries(compile_usage_exe PRIVATE $<COMPILE_ONLY:usage_lib>)