diff --git a/.travis.yml b/.travis.yml index b16d53a..a60e699 100644 --- a/.travis.yml +++ b/.travis.yml @@ -300,6 +300,28 @@ matrix: - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_DEBUG=1 .. - ctest --output-on-failure -R boost_static_assert + - 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/config.git ../config + 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=static_assert,config -DCMAKE_INSTALL_PREFIX=~/.local .. + - cmake --build . --target install + - cd ../test/cmake_install_test && mkdir __build__ && cd __build__ + - cmake -DCMAKE_INSTALL_PREFIX=~/.local .. + - cmake --build . + - cmake --build . --target check + - os: osx env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++03 diff --git a/test/cmake_install_test/CMakeLists.txt b/test/cmake_install_test/CMakeLists.txt new file mode 100644 index 0000000..d6f3ddf --- /dev/null +++ b/test/cmake_install_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 + +cmake_minimum_required(VERSION 3.5...3.16) + +project(cmake_install_test LANGUAGES CXX) + +find_package(boost_static_assert REQUIRED) + +add_executable(main main.cpp) +target_link_libraries(main Boost::static_assert) + +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..0ec36a8 --- /dev/null +++ b/test/cmake_install_test/main.cpp @@ -0,0 +1,7 @@ +#include + +int main() +{ + int const x = 5; + BOOST_STATIC_ASSERT( x > 4 ); +} diff --git a/test/cmake_subdir_test/CMakeLists.txt b/test/cmake_subdir_test/CMakeLists.txt new file mode 100644 index 0000000..a4cf790 --- /dev/null +++ b/test/cmake_subdir_test/CMakeLists.txt @@ -0,0 +1,18 @@ +# 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 + +cmake_minimum_required(VERSION 3.5...3.16) + +project(cmake_subdir_test LANGUAGES CXX) + +add_subdirectory(../../../static_assert boostorg/static_assert) +add_subdirectory(../../../config boostorg/config) + +add_executable(main main.cpp) +target_link_libraries(main Boost::static_assert) + +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..0ec36a8 --- /dev/null +++ b/test/cmake_subdir_test/main.cpp @@ -0,0 +1,7 @@ +#include + +int main() +{ + int const x = 5; + BOOST_STATIC_ASSERT( x > 4 ); +}