Skip to content

Commit

Permalink
fixed compilation with CMake < 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Feb 20, 2024
1 parent 95b3a13 commit 2ef8db6
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions test/signal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
add_executable(test-signalhandler
test-signalhandler.cpp
${PROJECT_SOURCE_DIR}/cli/signalhandler.cpp
${PROJECT_SOURCE_DIR}/cli/stacktrace.cpp)
target_include_directories(test-signalhandler PRIVATE ${PROJECT_SOURCE_DIR}/cli ${PROJECT_SOURCE_DIR}/lib)
# names for static functions are omitted from trace
target_compile_options_safe(test-signalhandler -Wno-missing-declarations)
target_compile_options_safe(test-signalhandler -Wno-missing-prototypes)
# required for backtrace() to produce function names
target_link_options(test-signalhandler PRIVATE -rdynamic)
if (CMAKE_VERSION VERSION_EQUAL "3.13" OR CMAKE_VERSION VERSION_GREATER "3.13")
# target_link_options requires CMake 3.13

add_executable(test-stacktrace
test-stacktrace.cpp
${PROJECT_SOURCE_DIR}/cli/stacktrace.cpp)
target_include_directories(test-stacktrace PRIVATE ${PROJECT_SOURCE_DIR}/cli ${PROJECT_SOURCE_DIR}/lib)
# names for static functions are omitted from trace
target_compile_options_safe(test-stacktrace -Wno-missing-declarations)
target_compile_options_safe(test-stacktrace -Wno-missing-prototypes)
# required for backtrace() to produce function names
target_link_options(test-stacktrace PRIVATE -rdynamic)
add_executable(test-signalhandler
test-signalhandler.cpp
${PROJECT_SOURCE_DIR}/cli/signalhandler.cpp
${PROJECT_SOURCE_DIR}/cli/stacktrace.cpp)
target_include_directories(test-signalhandler PRIVATE ${PROJECT_SOURCE_DIR}/cli ${PROJECT_SOURCE_DIR}/lib)
# names for static functions are omitted from trace
target_compile_options_safe(test-signalhandler -Wno-missing-declarations)
target_compile_options_safe(test-signalhandler -Wno-missing-prototypes)
# required for backtrace() to produce function names
target_link_options(test-signalhandler PRIVATE -rdynamic)

add_executable(test-stacktrace
test-stacktrace.cpp
${PROJECT_SOURCE_DIR}/cli/stacktrace.cpp)
target_include_directories(test-stacktrace PRIVATE ${PROJECT_SOURCE_DIR}/cli ${PROJECT_SOURCE_DIR}/lib)
# names for static functions are omitted from trace
target_compile_options_safe(test-stacktrace -Wno-missing-declarations)
target_compile_options_safe(test-stacktrace -Wno-missing-prototypes)
# required for backtrace() to produce function names
target_link_options(test-stacktrace PRIVATE -rdynamic)
endif()

0 comments on commit 2ef8db6

Please sign in to comment.