WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Merged
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
31 changes: 26 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,21 @@ 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
if [[ "$OSTYPE" == "darwin"* ]]; then
BACKENDS_ARRAY=(stacktrace stacktrace_noop stacktrace_basic)
else
BACKENDS_ARRAY=(stacktrace stacktrace_noop stacktrace_basic stacktrace_backtrace)
fi
for BACKEND in ${BACKENDS_ARRAY[@]}; do
rm -rf *
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DBOOST_STACKTRACE_IMPL_BACKEND=${BACKEND} ..
cmake --build .
ctest --output-on-failure --no-tests=error -V
done

posix-cmake-test:
strategy:
Expand Down Expand Up @@ -426,10 +437,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
6 changes: 2 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt

cmake_minimum_required(VERSION 3.5...3.16)
cmake_minimum_required(VERSION 3.8...4.20)

project(boost_stacktrace VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)

Expand Down 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
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.8...4.20)

project(cmake_install_test LANGUAGES CXX)

find_package(boost_stacktrace REQUIRED)

find_package(
Boost
REQUIRED stacktrace ${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