Closed damageboy closed 1 year ago
Thanks for this!
Note that this also fixes the requirement to use some of the custom functionality like ADD_BACKWARD
(I think) with just a plain FetchContent
For example, the below CMake project builds fine:
project(foo)
cmake_minimum_required(VERSION 3.20)
Include(FetchContent)
FetchContent_Declare(
backward
GIT_REPOSITORY https://github.com/damageboy/backward-cpp.git
GIT_TAG master # Fork which has CMake ALIAS target
)
FetchContent_MakeAvailable(backward)
# Add source files
file(GLOB_RECURSE SOURCES "src/*.cpp")
add_executable(foo ${SOURCES})
target_link_libraries(foo
PRIVATE
Backward::Backward bfd dl
)
@GavinRay97 Yeap, that's pretty much the idea, I can testify that it works for me with CPM (just a fancy wrapper around FetchContent) trying to get backward incorporated with minimal hassle.
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:
And in a project (or the same CMakeLists.txt):