forked from boostorg/function
Add test/cmake_install_test
This commit is contained in:
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_function REQUIRED)
|
||||||
|
|
||||||
|
add_executable(main main.cpp)
|
||||||
|
target_link_libraries(main Boost::function)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
add_test(main main)
|
||||||
|
|
||||||
|
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
22
test/cmake_install_test/main.cpp
Normal file
22
test/cmake_install_test/main.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright 2017, 2021 Peter Dimov.
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
// See library home page at http://www.boost.org/libs/function
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#define BOOST_TEST(expr) assert(expr)
|
||||||
|
#define BOOST_TEST_EQ(x1, x2) assert((x1)==(x2))
|
||||||
|
|
||||||
|
int add( int x, int y )
|
||||||
|
{
|
||||||
|
return x + y;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
boost::function<int(int, int)> fn( &add );
|
||||||
|
BOOST_TEST_EQ( fn( 1, 2 ), 3 );
|
||||||
|
}
|
Reference in New Issue
Block a user