Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

env:
UBSAN_OPTIONS: print_stacktrace=1
BOOST_SUPERPROJECT_VERSION: 1.88 # minimal Boost version for the CMake install tests

jobs:
posix:
Expand Down Expand Up @@ -265,10 +266,15 @@ jobs:
- name: Use the installed library
run: |
cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
cmake --build .
export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
ctest --output-on-failure --no-tests=error

set -e
for BACKEND in stacktrace stacktrace_noop stacktrace_basic stacktrace_backtrace; do
rm -rf *
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DBOOST_STACKTRACE_IMPL_BACKEND=${BACKEND} ..
cmake --build .
export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
ctest --output-on-failure --no-tests=error -V
done

posix-cmake-test:
strategy:
Expand Down Expand Up @@ -425,10 +431,20 @@ jobs:
shell: cmd
run: |
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DBOOST_STACKTRACE_IMPL_BACKEND=stacktrace ..
cmake --build . --config Debug
PATH C:\cmake-prefix\bin;%PATH%
ctest --output-on-failure --no-tests=error -C Debug
ctest --output-on-failure --no-tests=error -C Debug -V

cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DBOOST_STACKTRACE_IMPL_BACKEND=stacktrace_windbg ..
cmake --build . --config Debug
PATH C:\cmake-prefix\bin;%PATH%
ctest --output-on-failure --no-tests=error -C Debug -V

cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DBOOST_STACKTRACE_IMPL_BACKEND=stacktrace_windbg_cached ..
cmake --build . --config Debug
PATH C:\cmake-prefix\bin;%PATH%
ctest --output-on-failure --no-tests=error -C Debug -V

- name: Use the installed library (RelWithDebInfo)
shell: cmd
Expand Down
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ stacktrace_add_library(from_exception ${BOOST_STACKTRACE_ENABLE_FROM_EXCEPTION}

#

if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")

if(BUILD_TESTING)
add_subdirectory(test)

endif()
11 changes: 11 additions & 0 deletions doc/stacktrace.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,17 @@ target_link_libraries(${PROJECT} # your project
)
```

If Boost is installed into the system the best way to get it for your project
is via `find_package`:

```
find_package(
Boost 1.88 # Boost minimal version
REQUIRED stacktrace stacktrace_from_exception
CONFIG
)
```

[endsect]

[section CMake build notes]
Expand Down
15 changes: 11 additions & 4 deletions test/cmake_install_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt

cmake_minimum_required(VERSION 3.5...3.20)
cmake_minimum_required(VERSION 3.5...4.20)

project(cmake_install_test LANGUAGES CXX)

find_package(boost_stacktrace REQUIRED)

find_package(
Boost "$ENV{BOOST_SUPERPROJECT_VERSION}"
REQUIRED ${BOOST_STACKTRACE_IMPL_BACKEND} stacktrace_from_exception
CONFIG
)
add_executable(main main.cpp)
target_link_libraries(main Boost::stacktrace)
target_link_libraries(main Boost::${BOOST_STACKTRACE_IMPL_BACKEND})

add_executable(main_from_exception main.cpp)
target_link_libraries(main_from_exception Boost::stacktrace_from_exception Boost::${BOOST_STACKTRACE_IMPL_BACKEND})

enable_testing()
add_test(main main)
add_test(main_from_exception main_from_exception)
5 changes: 5 additions & 0 deletions test/cmake_install_test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@
int main()
{
std::cout << boost::stacktrace::stacktrace() << std::endl;
try {
throw 42;
} catch (...) {
std::cout << "From current excption:\n" << boost::stacktrace::stacktrace::from_current_exception() << std::endl;
}
}
Loading