Skip to content

Commit

Permalink
cmake: allow for inclusion with CPM
Browse files Browse the repository at this point in the history
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
)
```
  • Loading branch information
damageboy committed Jan 11, 2023
1 parent 90398ee commit 490fd39
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ endif()
add_library(backward ${libtype} backward.cpp)
target_compile_definitions(backward PUBLIC ${BACKWARD_DEFINITIONS})
target_include_directories(backward PUBLIC ${BACKWARD_INCLUDE_DIRS})
if(BACKWARD_HAS_EXTERNAL_LIBRARIES)
set_target_properties(backward PROPERTIES
INTERFACE_LINK_LIBRARIES "${BACKWARD_LIBRARIES}")
endif()
add_library(Backward::Backward ALIAS backward)

###############################################################################
# TESTS
Expand Down

0 comments on commit 490fd39

Please sign in to comment.