forked from boostorg/tuple
Add CMake tests
This commit is contained in:
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::tuple Boost::core)
|
||||
|
||||
endif()
|
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_tuple REQUIRED)
|
||||
|
||||
add_executable(main main.cpp)
|
||||
target_link_libraries(main Boost::tuple)
|
||||
|
||||
enable_testing()
|
||||
add_test(main main)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
18
test/cmake_install_test/main.cpp
Normal file
18
test/cmake_install_test/main.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
// Copyright 2017, 2021 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <cassert>
|
||||
|
||||
#define BOOST_TEST(expr) assert(expr)
|
||||
#define BOOST_TEST_EQ(x1, x2) assert((x1)==(x2))
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::tuple<int, int, int> tp( 1, 2, 3 );
|
||||
|
||||
BOOST_TEST_EQ( boost::get<0>(tp), 1 );
|
||||
BOOST_TEST_EQ( boost::get<1>(tp), 2 );
|
||||
BOOST_TEST_EQ( boost::get<2>(tp), 3 );
|
||||
}
|
40
test/cmake_subdir_test/CMakeLists.txt
Normal file
40
test/cmake_subdir_test/CMakeLists.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
# 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.20)
|
||||
|
||||
project(cmake_subdir_test LANGUAGES CXX)
|
||||
|
||||
add_subdirectory(../.. boostorg/tuple)
|
||||
|
||||
set(deps
|
||||
|
||||
# Primary dependencies
|
||||
|
||||
config
|
||||
core
|
||||
static_assert
|
||||
type_traits
|
||||
|
||||
# Secondary dependencies
|
||||
|
||||
assert
|
||||
throw_exception
|
||||
)
|
||||
|
||||
foreach(dep IN LISTS deps)
|
||||
|
||||
add_subdirectory(../../../${dep} boostorg/${dep})
|
||||
|
||||
endforeach()
|
||||
|
||||
# --target check
|
||||
|
||||
add_executable(quick ../quick.cpp)
|
||||
target_link_libraries(quick Boost::tuple Boost::core)
|
||||
|
||||
enable_testing()
|
||||
add_test(quick quick)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
Reference in New Issue
Block a user