|
|
|
@@ -123,3 +123,30 @@ NEXUS_HOST=http:://repository:1804 admake build |
|
|
|
NEXUS_HOST=http:://repository:1804 admake fetch protobuf |
|
|
|
``` |
|
|
|
|
|
|
|
### How to append or change `rpath/runpath` (Unix ONLY)? |
|
|
|
|
|
|
|
By default, `admake` will disable the `rpath` globally via `set (CMAKE_SKIP_BUILD_RPATH TRUE)`, so you will get clean `Shared Objects` or `ELFs`. |
|
|
|
|
|
|
|
If you want to append or change the `rpath/runpath`, you have three ways: |
|
|
|
|
|
|
|
1. `target_link_options`, *RECOMMENDED*: |
|
|
|
``` cmake |
|
|
|
target_link_options (${TARGET_NAME} |
|
|
|
PRIVATE "-Wl,-rpath,$ORIGIN") |
|
|
|
``` |
|
|
|
2. `set_target_properties` with `LINK_FLAGS`, **NOT** `LINK_OPTIONS`, |
|
|
|
because the `LINK_OPTIONS` will overwrite all the link flags. |
|
|
|
|
|
|
|
``` cmake |
|
|
|
set_target_properties (${TEST_TARGET_NAME} PROPERTIES |
|
|
|
LINK_FLAGS "-Wl,-rpath,$ORIGIN") |
|
|
|
``` |
|
|
|
3. `set_target_properties` with `SKIP_BUILD_RPATH OFF` and `BUILD_RPATH`, |
|
|
|
this has a side effect: will introduce all the `link_directories` into |
|
|
|
your `rpath/runpath`, them are appended by CMake automatically. |
|
|
|
``` cmake |
|
|
|
set_target_properties (${TEST_TARGET_NAME} PROPERTIES |
|
|
|
SKIP_BUILD_RPATH OFF |
|
|
|
BUILD_RPATH "$ORIGIN") |
|
|
|
``` |
|
|
|
|