diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b1cbd4..3be3a90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,26 +1,44 @@ -# Copyright 2019 Mike Dev +# Generated by `boostdep --cmake exception` +# Copyright 2020, 2021 Peter Dimov # Distributed under the Boost Software License, Version 1.0. -# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt +# https://www.boost.org/LICENSE_1_0.txt -cmake_minimum_required( VERSION 3.5...3.20 ) -project( boost_exception VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX ) +cmake_minimum_required(VERSION 3.5...3.20) -# We treat Boost.Exception as header only for now. -# See https://github.com/boostorg/exception/pull/17 -# for more information. +project(boost_exception VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) -add_library( boost_exception INTERFACE ) -add_library( Boost::exception ALIAS boost_exception ) - -target_include_directories( boost_exception INTERFACE include ) - -target_link_libraries( boost_exception - INTERFACE - Boost::assert - Boost::config - Boost::core - Boost::smart_ptr - Boost::throw_exception - Boost::tuple - Boost::type_traits +add_library(boost_exception + src/clone_current_exception_non_intrusive.cpp ) + +add_library(Boost::exception ALIAS boost_exception) + +target_include_directories(boost_exception PUBLIC include) + +target_link_libraries(boost_exception + PUBLIC + Boost::assert + Boost::config + Boost::core + Boost::smart_ptr + Boost::throw_exception + Boost::tuple + Boost::type_traits +) + +target_compile_definitions(boost_exception + PUBLIC BOOST_EXCEPTION_NO_LIB + PRIVATE BOOST_EXCEPTION_SOURCE +) + +if(BUILD_SHARED_LIBS) + target_compile_definitions(boost_exception PUBLIC BOOST_EXCEPTION_DYN_LINK) +else() + target_compile_definitions(boost_exception PUBLIC BOOST_EXCEPTION_STATIC_LINK) +endif() + +if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") + + add_subdirectory(test) + +endif()