mirror of
https://github.com/boostorg/variant2.git
synced 2025-07-30 04:07:16 +02:00
Add CMakeLists.txt
This commit is contained in:
@ -240,6 +240,15 @@ matrix:
|
|||||||
compiler: clang++
|
compiler: clang++
|
||||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1z
|
env: TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1z
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++
|
||||||
|
env: CMAKE_SUBDIR_TEST=1
|
||||||
|
script:
|
||||||
|
- cd libs/variant2/test/cmake_subdir_test && mkdir __build__ && cd __build__
|
||||||
|
- cmake ..
|
||||||
|
- 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 ..
|
||||||
|
21
CMakeLists.txt
Normal file
21
CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Copyright 2018, 2019 Peter Dimov
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
# Partial (add_subdirectory only) and experimental CMake support
|
||||||
|
# Subject to change; please do not rely on the contents of this file yet
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
|
project(BoostVariant2 LANGUAGES CXX)
|
||||||
|
|
||||||
|
add_library(boost_variant2 INTERFACE)
|
||||||
|
add_library(Boost::variant2 ALIAS boost_variant2)
|
||||||
|
|
||||||
|
target_include_directories(boost_variant2 INTERFACE include)
|
||||||
|
|
||||||
|
target_link_libraries(boost_variant2
|
||||||
|
INTERFACE
|
||||||
|
Boost::config
|
||||||
|
Boost::mp11
|
||||||
|
)
|
19
test/cmake_subdir_test/CMakeLists.txt
Normal file
19
test/cmake_subdir_test/CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# 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)
|
||||||
|
|
||||||
|
project(cmake_subdir_test LANGUAGES CXX)
|
||||||
|
|
||||||
|
add_subdirectory(../.. boostorg/variant2)
|
||||||
|
add_subdirectory(../../../config boostorg/config)
|
||||||
|
add_subdirectory(../../../mp11 boostorg/mp11)
|
||||||
|
|
||||||
|
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>)
|
15
test/cmake_subdir_test/quick.cpp
Normal file
15
test/cmake_subdir_test/quick.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
// Copyright 2019 Peter Dimov.
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/variant2/variant.hpp>
|
||||||
|
|
||||||
|
using namespace boost::variant2;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
variant<float, int> v( 2 );
|
||||||
|
return get<1>( v ) == 2;
|
||||||
|
}
|
Reference in New Issue
Block a user