Skip to content

Commit b72da9c

Browse files
committed
Merge branch 'extensive-cmake-install-testing' into runtime-check-and-install-tests
2 parents 544c340 + 8e79895 commit b72da9c

File tree

5 files changed

+50
-13
lines changed

5 files changed

+50
-13
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,16 @@ jobs:
266266
- name: Use the installed library
267267
run: |
268268
cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__
269-
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
270-
cmake --build .
269+
271270
export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
272-
ctest --output-on-failure --no-tests=error
271+
272+
set -e
273+
for BACKEND in stacktrace stacktrace_noop stacktrace_basic stacktrace_backtrace; do
274+
rm -rf *
275+
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DBOOST_STACKTRACE_IMPL_BACKEND=${BACKEND} ..
276+
cmake --build .
277+
ctest --output-on-failure --no-tests=error -V
278+
done
273279
274280
posix-cmake-test:
275281
strategy:
@@ -426,10 +432,20 @@ jobs:
426432
shell: cmd
427433
run: |
428434
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__
429-
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
435+
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DBOOST_STACKTRACE_IMPL_BACKEND=stacktrace ..
430436
cmake --build . --config Debug
431437
PATH C:\cmake-prefix\bin;%PATH%
432-
ctest --output-on-failure --no-tests=error -C Debug
438+
ctest --output-on-failure --no-tests=error -C Debug -V
439+
440+
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DBOOST_STACKTRACE_IMPL_BACKEND=stacktrace_windbg ..
441+
cmake --build . --config Debug
442+
PATH C:\cmake-prefix\bin;%PATH%
443+
ctest --output-on-failure --no-tests=error -C Debug -V
444+
445+
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix -DBOOST_STACKTRACE_IMPL_BACKEND=stacktrace_windbg_cached ..
446+
cmake --build . --config Debug
447+
PATH C:\cmake-prefix\bin;%PATH%
448+
ctest --output-on-failure --no-tests=error -C Debug -V
433449
434450
- name: Use the installed library (RelWithDebInfo)
435451
shell: cmd

CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Distributed under the Boost Software License, Version 1.0.
33
# https://www.boost.org/LICENSE_1_0.txt
44

5-
cmake_minimum_required(VERSION 3.5...3.16)
5+
cmake_minimum_required(VERSION 3.8...4.20)
66

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

@@ -142,8 +142,6 @@ stacktrace_add_library(from_exception ${BOOST_STACKTRACE_ENABLE_FROM_EXCEPTION}
142142

143143
#
144144

145-
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
146-
145+
if(BUILD_TESTING)
147146
add_subdirectory(test)
148-
149147
endif()

doc/stacktrace.qbk

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,17 @@ target_link_libraries(${PROJECT} # your project
334334
)
335335
```
336336

337+
If Boost is installed into the system the best way to get it for your project
338+
is via `find_package`:
339+
340+
```
341+
find_package(
342+
Boost
343+
REQUIRED stacktrace stacktrace_from_exception
344+
CONFIG
345+
)
346+
```
347+
337348
[endsect]
338349

339350
[section CMake build notes]

test/cmake_install_test/CMakeLists.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@
22
# Distributed under the Boost Software License, Version 1.0.
33
# https://www.boost.org/LICENSE_1_0.txt
44

5-
cmake_minimum_required(VERSION 3.5...3.20)
5+
cmake_minimum_required(VERSION 3.8...4.20)
66

77
project(cmake_install_test LANGUAGES CXX)
88

9-
find_package(boost_stacktrace REQUIRED)
10-
9+
find_package(
10+
Boost
11+
REQUIRED stacktrace ${BOOST_STACKTRACE_IMPL_BACKEND} stacktrace_from_exception
12+
CONFIG
13+
)
1114
add_executable(main main.cpp)
12-
target_link_libraries(main Boost::stacktrace)
15+
target_link_libraries(main Boost::${BOOST_STACKTRACE_IMPL_BACKEND})
16+
17+
add_executable(main_from_exception main.cpp)
18+
target_link_libraries(main_from_exception Boost::stacktrace_from_exception Boost::${BOOST_STACKTRACE_IMPL_BACKEND})
1319

1420
enable_testing()
1521
add_test(main main)
22+
add_test(main_from_exception main_from_exception)

test/cmake_install_test/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@
99
int main()
1010
{
1111
std::cout << boost::stacktrace::stacktrace() << std::endl;
12+
try {
13+
throw 42;
14+
} catch (...) {
15+
std::cout << "From current excption:\n" << boost::stacktrace::stacktrace::from_current_exception() << std::endl;
16+
}
1217
}

0 commit comments

Comments
 (0)