2
0
mirror of https://github.com/boostorg/cmake.git synced 2026-01-19 04:02:15 +00:00

Add tests for compatibility targets (Boost::boost, Boost::disable_autolinking, etc)

This commit is contained in:
Peter Dimov
2024-05-14 19:30:09 +03:00
parent 59bdd93ebb
commit c2feb91bd6
5 changed files with 81 additions and 0 deletions

View File

@@ -474,6 +474,22 @@ jobs:
cmake --build . --target install
cmake --install .
- name: Test add_subdirectory compatibility targets
run: |
cd ../boost-root/tools/cmake/test/add_subdir_compat
mkdir __build__ && cd __build__
cmake -DBoost_VERBOSE=ON -DBUILD_SHARED_LIBS=${{matrix.shared}} ..
cmake --build .
ctest --output-on-failure --no-tests=error
- name: Test add_subdirectory(EXCLUDE_FROM_ALL) compatibility targets
run: |
cd ../boost-root/tools/cmake/test/add_subdir_exc_compat
mkdir __build__ && cd __build__
cmake -DBoost_VERBOSE=ON -DBUILD_SHARED_LIBS=${{matrix.shared}} ..
cmake --build .
ctest --output-on-failure --no-tests=error
posix-target-check:
strategy:
fail-fast: false

View File

@@ -0,0 +1,21 @@
# Copyright 2018-2024 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.20)
project(boost_add_sibdir_compat_test LANGUAGES CXX)
include(CTest)
set(BOOST_INCLUDE_LIBRARIES smart_ptr timer)
set(BOOST_ENABLE_COMPATIBILITY_TARGETS ON)
add_subdirectory(../../../.. deps/boost)
add_executable(main main.cpp)
target_link_libraries(main Boost::boost Boost::timer Boost::disable_autolinking)
add_test(NAME main COMMAND main)
install(TARGETS main)

View File

@@ -0,0 +1,12 @@
// Copyright 2019, 2024 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/timer/timer.hpp>
#include <boost/shared_ptr.hpp>
int main()
{
boost::shared_ptr<boost::timer::cpu_timer> timer = boost::make_shared<boost::timer::cpu_timer>();
timer->stop();
}

View File

@@ -0,0 +1,20 @@
# Copyright 2018-2024 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.20)
project(boost_add_sibdir_exc_compat_test LANGUAGES CXX)
include(CTest)
set(BOOST_ENABLE_COMPATIBILITY_TARGETS ON)
add_subdirectory(../../../.. deps/boost EXCLUDE_FROM_ALL)
add_executable(main main.cpp)
target_link_libraries(main Boost::boost Boost::timer Boost::disable_autolinking)
add_test(NAME main COMMAND main)
install(TARGETS main)

View File

@@ -0,0 +1,12 @@
// Copyright 2019, 2024 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/timer/timer.hpp>
#include <boost/shared_ptr.hpp>
int main()
{
boost::shared_ptr<boost::timer::cpu_timer> timer = boost::make_shared<boost::timer::cpu_timer>();
timer->stop();
}