diff options
author | mj-xmr <mjxmr@protonmail.com> | 2020-10-26 20:53:21 +0100 |
---|---|---|
committer | mj-xmr <mjxmr@protonmail.com> | 2020-10-28 20:08:26 +0100 |
commit | 8a282f64c9c99f584d2a1bd06a11ad5651cd2413 (patch) | |
tree | 6f145354d796770e5e84ca6b3579b5c1231f7ee3 /CMakeLists.txt | |
parent | Merge pull request #6902 (diff) | |
download | monero-8a282f64c9c99f584d2a1bd06a11ad5651cd2413.tar.xz |
Add RELINK_TARGETS, monero_add_target_no_relink and use monero_add_executable/monero_add_library where possible (mj-xmr)
Add monero_add_minimal_executable and use in tests
This is done in order not to have to relink targets, when just an .so changed, but not its interface.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 316fd7ed8..57dec93c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,6 +111,24 @@ function (add_definition_if_library_exists library function header var) endif() endfunction() +option(RELINK_TARGETS "Relink targets, when just a dependant .so changed, but not its header?" OFF) +function (monero_set_target_no_relink target) + if (RELINK_TARGETS MATCHES OFF) + # Will not relink the target, when just its dependant .so has changed, but not it's interface + set_target_properties("${target}" PROPERTIES LINK_DEPENDS_NO_SHARED true) + endif() +endfunction() + +function (monero_add_minimal_executable name) + source_group("${name}" + FILES + ${ARGN}) + + add_executable("${name}" + ${ARGN}) + monero_set_target_no_relink( ${name} ) +endfunction() + if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}") |