From 00c364a0cbffefab6ba1982d6e1d630b08c72916 Mon Sep 17 00:00:00 2001 From: Ben Cumming <bcumming@cscs.ch> Date: Thu, 29 Aug 2019 12:03:11 +0200 Subject: [PATCH] libunwind is optional and off by default. (#855) * libunwind is optional, and off by default. * fix description of CMake option --- CMakeLists.txt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c080094..0ffce50f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,10 @@ set(ARB_VALIDATION_DATA_DIR "${PROJECT_SOURCE_DIR}/validation/data" CACHE PATH option(ARB_USE_POSIX_GLOB "wrap POSIX glob(3) for glob functionality" ON) +# Use libunwind to generate stack traces on errors? + +option(ARB_UNWIND "Use libunwind for stack trace printing if available" OFF) + #---------------------------------------------------------- # Configure-time features for Arbor: #---------------------------------------------------------- @@ -275,15 +279,17 @@ if(ARB_WITH_GPU) $<$<COMPILE_LANGUAGE:CUDA>:-gencode=arch=compute_70,code=sm_70>) endif() -# Use libunwind if available for pretty printing stack traces +# Use libunwind if requested for pretty printing stack traces #------------------------------------------------------------- -find_package(Unwind) -if(Unwind_FOUND) - target_link_libraries(arbor-private-deps INTERFACE Unwind::unwind) - target_compile_definitions(arbor-private-deps INTERFACE WITH_UNWIND) +if (ARB_UNWIND) + find_package(Unwind REQUIRED) + if(Unwind_FOUND) + target_link_libraries(arbor-private-deps INTERFACE Unwind::unwind) + target_compile_definitions(arbor-private-deps INTERFACE WITH_UNWIND) - list(APPEND arbor_export_dependencies "Unwind") + list(APPEND arbor_export_dependencies "Unwind") + endif() endif() # Build and use modcc unless explicit path given -- GitLab