forked from boostorg/typeof
Add CMake tests
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
# Copyright 2018-2020 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(BoostTest OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
|
||||
|
||||
if(NOT HAVE_BOOST_TEST)
|
||||
return()
|
||||
endif()
|
||||
|
||||
macro(typeof_test s1)
|
||||
|
||||
string(MAKE_C_IDENTIFIER ${s1} n1)
|
||||
|
||||
boost_test(TYPE compile SOURCES ${s1} ${ARGN} COMPILE_DEFINITIONS BOOST_TYPEOF_NATIVE NAME ${n1}_native)
|
||||
boost_test(TYPE compile SOURCES ${s1} ${ARGN} COMPILE_DEFINITIONS BOOST_TYPEOF_EMULATION NAME ${n1}_emulation)
|
||||
|
||||
endmacro()
|
||||
|
||||
set(BOOST_TEST_LINK_LIBRARIES Boost::typeof Boost::core)
|
||||
|
||||
set(tests
|
||||
|
||||
data_member.cpp
|
||||
function.cpp
|
||||
function_binding.cpp
|
||||
function_ptr.cpp
|
||||
function_ptr_from_tpl.cpp
|
||||
function_ref.cpp
|
||||
member_function.cpp
|
||||
modifiers.cpp
|
||||
msvc_typeof_in_lambda.cpp
|
||||
nested_typedef.cpp
|
||||
noncopyable.cpp
|
||||
std.cpp
|
||||
template_dependent.cpp
|
||||
template_enum.cpp
|
||||
template_int.cpp
|
||||
template_multiword.cpp
|
||||
template_tpl.cpp
|
||||
template_type.cpp
|
||||
type.cpp
|
||||
)
|
||||
|
||||
foreach(test IN LISTS tests)
|
||||
|
||||
typeof_test(${test})
|
||||
|
||||
endforeach()
|
||||
|
||||
boost_test(TYPE run SOURCES odr1.cpp odr2.cpp COMPILE_DEFINITIONS BOOST_TYPEOF_NATIVE NAME odr_native)
|
||||
boost_test(TYPE run SOURCES odr1.cpp odr2.cpp COMPILE_DEFINITIONS BOOST_TYPEOF_EMULATED NAME odr_emulated)
|
||||
|
||||
boost_test(TYPE run SOURCES odr_no_uns1.cpp odr_no_uns2.cpp COMPILE_DEFINITIONS BOOST_TYPEOF_EMULATED NAME odr_no_uns)
|
||||
@@ -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_typeof REQUIRED)
|
||||
|
||||
add_executable(main main.cpp)
|
||||
target_link_libraries(main Boost::typeof)
|
||||
|
||||
enable_testing()
|
||||
add_test(main main)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright 2017, 2021 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_AUTO(x, 5);
|
||||
return x == 5;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
# 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/typeof)
|
||||
|
||||
set(deps
|
||||
|
||||
# Primary dependencies
|
||||
|
||||
config
|
||||
preprocessor
|
||||
type_traits
|
||||
|
||||
# Secondary dependencies
|
||||
|
||||
static_assert
|
||||
)
|
||||
|
||||
foreach(dep IN LISTS deps)
|
||||
|
||||
add_subdirectory(../../../${dep} boostorg/${dep})
|
||||
|
||||
endforeach()
|
||||
|
||||
# --target check
|
||||
|
||||
add_executable(main main.cpp)
|
||||
target_link_libraries(quick Boost::typeof)
|
||||
|
||||
enable_testing()
|
||||
add_test(main main)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright 2017, 2021 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_AUTO(x, 5);
|
||||
return x == 5;
|
||||
}
|
||||
Reference in New Issue
Block a user