Add test/cmake_install_test, test/cmake_subdir_test

This commit is contained in:
Peter Dimov
2026-02-14 02:43:34 +02:00
parent a6df94e0f3
commit 0025f924b6
4 changed files with 65 additions and 0 deletions
+17
View 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.31)
project(cmake_install_test LANGUAGES CXX)
find_package(boost_convert REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main Boost::convert)
enable_testing()
add_test(main main)
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
+15
View File
@@ -0,0 +1,15 @@
// Copyright 2026 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/convert.hpp>
#include <boost/convert/stream.hpp>
#include <string>
struct boost::cnv::by_default: boost::cnv::cstream {};
int main()
{
int x = boost::convert<int>( "14" ).value_or( -1 );
return x == 14? 0: 1;
}
+18
View File
@@ -0,0 +1,18 @@
# 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.31)
project(cmake_subdir_test LANGUAGES CXX)
set(BOOST_INCLUDE_LIBRARIES convert)
add_subdirectory(../../../.. boostorg/boost)
add_executable(main main.cpp)
target_link_libraries(main Boost::convert)
enable_testing()
add_test(main main)
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
+15
View File
@@ -0,0 +1,15 @@
// Copyright 2026 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/convert.hpp>
#include <boost/convert/stream.hpp>
#include <string>
struct boost::cnv::by_default: boost::cnv::cstream {};
int main()
{
int x = boost::convert<int>( "14" ).value_or( -1 );
return x == 14? 0: 1;
}