blob: 879f4b8455b917e5ef74ceed75df8d22da39f7f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
enable_language(C)
add_library(foo SHARED obj1.c)
set_target_properties(foo PROPERTIES
VERSION 1.0
SOVERSION 1
INSTALL_RPATH "$ORIGIN"
)
install(TARGETS foo DESTINATION lib)
# Replace the .so "namelink" symlink with a linker script.
# It is no longer a symlink, so any install tweaks would break.
# This verifies that no install tweaks are added for the namelink.
set(linker_script "INPUT($<TARGET_SONAME_FILE_NAME:foo>)")
add_custom_command(TARGET foo POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E remove "$<TARGET_LINKER_FILE:foo>"
COMMAND "${CMAKE_COMMAND}" -E echo "${linker_script}" > "$<TARGET_LINKER_FILE:foo>"
COMMENT "Generating linker script: '${linker_script}' as file $<TARGET_LINKER_FILE:foo>"
VERBATIM
)
|