diff options
author | luigi1111 <luigi1111w@gmail.com> | 2021-06-16 14:37:39 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2021-06-16 14:37:39 -0500 |
commit | ab0bb315184ff8ae2b1a34168f70425209a5397f (patch) | |
tree | 5b9743697b840c71d88ed12bb32fd24bba2f10f6 | |
parent | Merge pull request #7676 (diff) | |
parent | CMake: strip targets (optional) with -D STRIP_TARGETS=ON (diff) | |
download | monero-ab0bb315184ff8ae2b1a34168f70425209a5397f.tar.xz |
Merge pull request #7683
41297c1 CMake: strip targets (optional) with -D STRIP_TARGETS=ON (mj-xmr)
-rw-r--r-- | CMakeLists.txt | 13 | ||||
-rw-r--r-- | src/CMakeLists.txt | 1 |
2 files changed, 13 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b35eb2b7a..29576a5bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,6 +154,15 @@ function (monero_set_target_no_relink target) endif() endfunction() +option(STRIP_TARGETS "Strip symbols from targets?" OFF) +function (monero_set_target_strip target) + if (STRIP_TARGETS) + set_target_properties("${target}" PROPERTIES LINK_FLAGS_RELEASE -s) + set_target_properties("${target}" PROPERTIES LINK_FLAGS_DEBUG -s) + # Stripping from Debug might make sense if you're low on disk space, but want to test if debug version builds properly. + endif() +endfunction() + function (monero_add_minimal_executable name) source_group("${name}" FILES @@ -161,7 +170,8 @@ function (monero_add_minimal_executable name) add_executable("${name}" ${ARGN}) - monero_set_target_no_relink( ${name} ) + monero_set_target_no_relink("${name}") + monero_set_target_strip ("${name}") endfunction() # Finds all headers in a directory and its subdirs, to be able to search for them and autosave in IDEs. @@ -556,6 +566,7 @@ function (monero_add_library_with_deps) add_library(${objlib} OBJECT ${MONERO_ADD_LIBRARY_SOURCES}) add_library("${MONERO_ADD_LIBRARY_NAME}" $<TARGET_OBJECTS:${objlib}>) monero_set_target_no_relink("${MONERO_ADD_LIBRARY_NAME}") + monero_set_target_strip ("${MONERO_ADD_LIBRARY_NAME}") if (MONERO_ADD_LIBRARY_DEPENDS) add_dependencies(${objlib} ${MONERO_ADD_LIBRARY_DEPENDS}) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1f89faf98..aaaae3a09 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -77,6 +77,7 @@ function (monero_add_executable name) enable_stack_trace("${name}") monero_set_target_no_relink("${name}") + monero_set_target_strip ("${name}") endfunction () include(Version) |