aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-11-29 01:49:39 -0600
committerluigi1111 <luigi1111w@gmail.com>2020-11-29 01:49:39 -0600
commit7a0334742ab6eecf4366b7cb69e3ae61f76c4a02 (patch)
tree619dbb4fec87baffb5683f3f3ea043f96b163563 /CMakeLists.txt
parentMerge pull request #6933 (diff)
parentAdd RELINK_TARGETS, monero_add_target_no_relink and use monero_add_executable... (diff)
downloadmonero-7a0334742ab6eecf4366b7cb69e3ae61f76c4a02.tar.xz
Merge pull request #6937
8a282f6 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 (mj-xmr)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0920b34f3..050269218 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -125,6 +125,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}")