forked from boostorg/variant2
Add CMake tests
This commit is contained in:
28
.travis.yml
28
.travis.yml
@ -251,22 +251,44 @@ matrix:
|
|||||||
compiler: clang++
|
compiler: clang++
|
||||||
env: UBSAN=1 TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1z UBSAN_OPTIONS=print_stacktrace=1
|
env: UBSAN=1 TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1z UBSAN_OPTIONS=print_stacktrace=1
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: CMAKE_TEST=1
|
||||||
|
script:
|
||||||
|
- mkdir __build__ && cd __build__
|
||||||
|
- cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=variant2 ..
|
||||||
|
- ctest --output-on-failure -R boost_variant2
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: g++
|
compiler: g++
|
||||||
env: CMAKE_SUBDIR_TEST=1
|
env: CMAKE_SUBDIR_TEST=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
|
||||||
|
- git clone -b $BOOST_BRANCH https://github.com/boostorg/mp11.git ../mp11
|
||||||
script:
|
script:
|
||||||
- cd libs/variant2/test/cmake_subdir_test && mkdir __build__ && cd __build__
|
- cd test/cmake_subdir_test && mkdir __build__ && cd __build__
|
||||||
- cmake ..
|
- cmake ..
|
||||||
- cmake --build .
|
- cmake --build .
|
||||||
- cmake --build . --target check
|
- cmake --build . --target check
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: CMAKE_INSTALL_TEST=1
|
||||||
|
script:
|
||||||
|
- mkdir __build__ && cd __build__
|
||||||
|
- cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES="variant2;config;mp11" -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||||
|
- cmake --build . --target install
|
||||||
|
- cd ../libs/variant2/test/cmake_install_test && mkdir __build__ && cd __build__
|
||||||
|
- cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||||
|
- cmake --build .
|
||||||
|
- cmake --build . --target check
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
||||||
- cd ..
|
- cd ..
|
||||||
- git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
- git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
- cd boost-root
|
- cd boost-root
|
||||||
- git submodule update --init tools/build
|
|
||||||
- git submodule update --init libs/config
|
|
||||||
- git submodule update --init tools/boostdep
|
- git submodule update --init tools/boostdep
|
||||||
- mkdir -p libs/variant2
|
- mkdir -p libs/variant2
|
||||||
- cp -r $TRAVIS_BUILD_DIR/* libs/variant2
|
- cp -r $TRAVIS_BUILD_DIR/* libs/variant2
|
||||||
|
@ -23,3 +23,9 @@ if(BOOST_SUPERPROJECT_VERSION)
|
|||||||
boost_install(TARGETS boost_variant2 HEADER_DIRECTORY include/)
|
boost_install(TARGETS boost_variant2 HEADER_DIRECTORY include/)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_TESTING)
|
||||||
|
|
||||||
|
add_subdirectory(test)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
11
test/CMakeLists.txt
Normal file
11
test/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# 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 LINK_LIBRARIES Boost::variant2 Boost::core)
|
||||||
|
|
||||||
|
endif()
|
@ -23,6 +23,8 @@ project
|
|||||||
<toolset>clang:<warnings-as-errors>on
|
<toolset>clang:<warnings-as-errors>on
|
||||||
;
|
;
|
||||||
|
|
||||||
|
run quick.cpp ;
|
||||||
|
|
||||||
run variant_size.cpp ;
|
run variant_size.cpp ;
|
||||||
run variant_alternative.cpp ;
|
run variant_alternative.cpp ;
|
||||||
|
|
||||||
|
17
test/cmake_install_test/CMakeLists.txt
Normal file
17
test/cmake_install_test/CMakeLists.txt
Normal file
@ -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_variant2 REQUIRED)
|
||||||
|
|
||||||
|
add_executable(quick ../quick.cpp)
|
||||||
|
target_link_libraries(quick Boost::variant2)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
add_test(quick quick)
|
||||||
|
|
||||||
|
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
@ -2,7 +2,7 @@
|
|||||||
# Distributed under the Boost Software License, Version 1.0.
|
# 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
|
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5...3.16)
|
||||||
|
|
||||||
project(cmake_subdir_test LANGUAGES CXX)
|
project(cmake_subdir_test LANGUAGES CXX)
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ add_subdirectory(../.. boostorg/variant2)
|
|||||||
add_subdirectory(../../../config boostorg/config)
|
add_subdirectory(../../../config boostorg/config)
|
||||||
add_subdirectory(../../../mp11 boostorg/mp11)
|
add_subdirectory(../../../mp11 boostorg/mp11)
|
||||||
|
|
||||||
add_executable(quick quick.cpp)
|
add_executable(quick ../quick.cpp)
|
||||||
target_link_libraries(quick Boost::variant2)
|
target_link_libraries(quick Boost::variant2)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
Reference in New Issue
Block a user