From aad95c266721826d9a16d1da3da7904eaea79455 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 21 Jun 2024 17:05:04 +0300 Subject: [PATCH] Add cmake_install_test, cmake_subdir_test --- test/cmake_install_test/CMakeLists.txt | 15 +++++++++ test/cmake_install_test/main.cpp | 12 +++++++ test/cmake_subdir_test/CMakeLists.txt | 46 ++++++++++++++++++++++++++ test/cmake_subdir_test/main.cpp | 12 +++++++ 4 files changed, 85 insertions(+) create mode 100644 test/cmake_install_test/CMakeLists.txt create mode 100644 test/cmake_install_test/main.cpp create mode 100644 test/cmake_subdir_test/CMakeLists.txt create mode 100644 test/cmake_subdir_test/main.cpp diff --git a/test/cmake_install_test/CMakeLists.txt b/test/cmake_install_test/CMakeLists.txt new file mode 100644 index 0000000..8d37aca --- /dev/null +++ b/test/cmake_install_test/CMakeLists.txt @@ -0,0 +1,15 @@ +# Copyright 2018-2021 Peter Dimov +# 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) + +project(cmake_install_test LANGUAGES CXX) + +find_package(boost_stacktrace REQUIRED) + +add_executable(main main.cpp) +target_link_libraries(main Boost::stacktrace_basic) + +enable_testing() +add_test(main main) diff --git a/test/cmake_install_test/main.cpp b/test/cmake_install_test/main.cpp new file mode 100644 index 0000000..5bd847e --- /dev/null +++ b/test/cmake_install_test/main.cpp @@ -0,0 +1,12 @@ +// Copyright 2019 Peter Dimov +// Copyright 2022-2024 Antony Polukhin +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include +#include + +int main() +{ + std::cout << boost::stacktrace::stacktrace() << std::endl; +} diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt new file mode 100644 index 0000000..5b641f5 --- /dev/null +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -0,0 +1,46 @@ +# Copyright 2018-2021 Peter Dimov +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt + +cmake_minimum_required(VERSION 3.5...3.20) + +project(cmake_subdir_test LANGUAGES CXX) + +# Put boost_stacktrace_*.dll in the same directory as main.exe +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + +add_subdirectory(../.. boostorg/stacktrace) + +# boostdep --brief stacktrace + +set(deps + +# Primary dependencies + +assert +config +container_hash +core +predef +winapi + +# Secondary dependencies + +describe +mp11 +static_assert +throw_exception + +) + +foreach(dep IN LISTS deps) + + add_subdirectory(../../../${dep} boostorg/${dep}) + +endforeach() + +add_executable(main main.cpp) +target_link_libraries(main Boost::stacktrace_basic) + +enable_testing() +add_test(main main) diff --git a/test/cmake_subdir_test/main.cpp b/test/cmake_subdir_test/main.cpp new file mode 100644 index 0000000..5bd847e --- /dev/null +++ b/test/cmake_subdir_test/main.cpp @@ -0,0 +1,12 @@ +// Copyright 2019 Peter Dimov +// Copyright 2022-2024 Antony Polukhin +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include +#include + +int main() +{ + std::cout << boost::stacktrace::stacktrace() << std::endl; +}