Skip to content

Commit 490fd39

Browse files
committed
cmake: allow for inclusion with CPM
Allow using backwards-cpp through CPM (Cmake Package Manager)/FetchContent without using the ${BACKWARD_ENABLE} target CPM (https://github.com/cpm-cmake/CPM.cmake) can now be used like so: In a main/top-level CMakeLists.txt: ```cmake include(cmake/CPM.cmake) CPMAddPackage("gh:#1.7") ``` And in a project (or the same CMakeLists.txt): ```cmake cmake_minimum_required(VERSION 3.9) project (example VERSION 0.1) add_executable(example main.cpp ) target_link_libraries(example Backward::Backward ) ```
1 parent 90398ee commit 490fd39

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ endif()
8686
add_library(backward ${libtype} backward.cpp)
8787
target_compile_definitions(backward PUBLIC ${BACKWARD_DEFINITIONS})
8888
target_include_directories(backward PUBLIC ${BACKWARD_INCLUDE_DIRS})
89+
if(BACKWARD_HAS_EXTERNAL_LIBRARIES)
90+
set_target_properties(backward PROPERTIES
91+
INTERFACE_LINK_LIBRARIES "${BACKWARD_LIBRARIES}")
92+
endif()
93+
add_library(Backward::Backward ALIAS backward)
8994

9095
###############################################################################
9196
# TESTS

0 commit comments

Comments
 (0)