aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorredfish <redfish@galactica.pw>2016-07-28 21:19:01 -0400
committerredfish <redfish@galactica.pw>2016-07-28 21:20:50 -0400
commit042db0bd0f852b5643870588f48643db88b77035 (patch)
tree2860fe999cea3efcee3736fed9a75bc6a676782f /src/CMakeLists.txt
parentMerge pull request #937 (diff)
downloadmonero-042db0bd0f852b5643870588f48643db88b77035.tar.xz
cmake: cleanup logic that sets flags per target/subdir
The previous logic that used a COMMON_*_FLAGS intermediate variable and then re-assigned CMAKE_*_FLAGS before including each subdirectory was confusing and ugly. This PR is the right way to do it. This commit is purely refactoring: built binaries unchanged.
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e2349744d..8fa617aff 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -47,6 +47,17 @@ function (bitmonero_install_headers subdir)
COMPONENT development)
endfunction ()
+function (enable_stack_trace target)
+ if(STACK_TRACE)
+ set_property(TARGET ${target}
+ APPEND PROPERTY COMPILER_DEFINITIONS "-DSTACK_TRACE")
+ if (STATIC)
+ set_property(TARGET "${target}"
+ APPEND PROPERTY LINK_FLAGS "-Wl,--wrap=__cxa_throw")
+ endif()
+ endif()
+endfunction()
+
function (bitmonero_add_executable name)
source_group("${name}"
FILES
@@ -63,6 +74,7 @@ function (bitmonero_add_executable name)
set_property(TARGET "${name}"
PROPERTY
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+ enable_stack_trace("${name}")
endfunction ()
function (bitmonero_add_library name)