diff --git a/.travis.yml b/.travis.yml
index 06a0455..59d61aa 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -305,6 +305,37 @@ matrix:
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
+ - os: linux
+ env: CMAKE=1
+ script:
+ - mkdir __build__ && cd __build__
+ - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_DEBUG=1 ..
+ - ctest --output-on-failure -R boost_throw_exception
+
+ - os: linux
+ env: CMAKE_SUBDIR=1
+ install:
+ - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
+ - git clone -b $BOOST_BRANCH https://github.com/boostorg/assert.git ../assert
+ - git clone -b $BOOST_BRANCH https://github.com/boostorg/config.git ../config
+ - git clone -b $BOOST_BRANCH https://github.com/boostorg/core.git ../core
+ script:
+ - cd test/cmake_subdir_test && mkdir __build__ && cd __build__
+ - cmake ..
+ - cmake --build .
+ - cmake --build . --target check
+
+ - os: linux
+ env: CMAKE_INSTALL=1
+ script:
+ - mkdir __build__ && cd __build__
+ - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_DEBUG=1 -DBOOST_INCLUDE_LIBRARIES="assert;config;throw_exception" -DCMAKE_INSTALL_PREFIX=~/.local ..
+ - cmake --build . --target install
+ - cd ../libs/throw_exception/test/cmake_install_test && mkdir __build__ && cd __build__
+ - cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
+ - cmake --build .
+ - cmake --build . --target check
+
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- cd ..
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ecb565..21fe5f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,3 +22,9 @@ if(BOOST_SUPERPROJECT_VERSION)
boost_install(TARGETS boost_throw_exception HEADER_DIRECTORY include/)
endif()
+
+if(BUILD_TESTING)
+
+ add_subdirectory(test)
+
+endif()
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000..486b61f
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Copyright 2018, 2019 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
+
+include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
+
+if(HAVE_BOOST_TEST)
+
+boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::throw_exception Boost::core Boost::exception)
+
+endif()
+
+#run throw_from_library_test.cpp lib1_throw lib2_throw lib3_throw : : : static : throw_from_library_static ;
+#run throw_from_library_test.cpp lib1_throw lib2_throw lib3_throw : : : shared : throw_from_library_shared ;
+
+#run throw_exception_nx_test.cpp : : : off ;
+#run throw_exception_nx_test2.cpp : : : off ;
diff --git a/test/Jamfile.v2 b/test/Jamfile.v2
index 0442ce1..0fa060e 100644
--- a/test/Jamfile.v2
+++ b/test/Jamfile.v2
@@ -20,7 +20,8 @@ run throw_exception_no_exceptions_test.cpp ;
run throw_exception_no_integration_test.cpp ;
run throw_exception_no_both_test.cpp ;
-compile-fail throw_exception_fail.cpp : off ;
+compile-fail throw_exception_fail.cpp
+ : off ;
run throw_exception_test2.cpp ;
run throw_exception_test3.cpp ;
diff --git a/test/cmake_install_test/CMakeLists.txt b/test/cmake_install_test/CMakeLists.txt
new file mode 100644
index 0000000..d48c3ec
--- /dev/null
+++ b/test/cmake_install_test/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Copyright 2018 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.16)
+
+project(cmake_install_test LANGUAGES CXX)
+
+find_package(boost_throw_exception REQUIRED)
+
+add_executable(main main.cpp)
+target_link_libraries(main Boost::throw_exception)
+
+enable_testing()
+add_test(NAME main COMMAND main)
+
+add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $)
diff --git a/test/cmake_install_test/main.cpp b/test/cmake_install_test/main.cpp
new file mode 100644
index 0000000..771931e
--- /dev/null
+++ b/test/cmake_install_test/main.cpp
@@ -0,0 +1,19 @@
+// Copyright 2019 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
+
+#include
+#include
+
+int main()
+{
+ try
+ {
+ boost::throw_exception( std::runtime_error( "" ) );
+ return 1;
+ }
+ catch( std::runtime_error const& )
+ {
+ return 0;
+ }
+}
diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt
new file mode 100644
index 0000000..2a13466
--- /dev/null
+++ b/test/cmake_subdir_test/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Copyright 2018 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.16)
+
+project(cmake_subdir_test LANGUAGES CXX)
+
+add_subdirectory(../../../assert boostorg/assert)
+add_subdirectory(../../../config boostorg/config)
+
+add_executable(main main.cpp)
+target_link_libraries(main Boost::throw_exception)
+
+enable_testing()
+add_test(NAME main COMMAND main)
+
+add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $)
diff --git a/test/cmake_subdir_test/main.cpp b/test/cmake_subdir_test/main.cpp
new file mode 100644
index 0000000..771931e
--- /dev/null
+++ b/test/cmake_subdir_test/main.cpp
@@ -0,0 +1,19 @@
+// Copyright 2019 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
+
+#include
+#include
+
+int main()
+{
+ try
+ {
+ boost::throw_exception( std::runtime_error( "" ) );
+ return 1;
+ }
+ catch( std::runtime_error const& )
+ {
+ return 0;
+ }
+}