Skip to content

Commit 1b67620

Browse files
committed
fix cmake test
1 parent 3632b00 commit 1b67620

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

test/cmake_test/CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,18 @@ set(__ignore__ ${CMAKE_C_COMPILER})
1212
set(__ignore__ ${CMAKE_C_FLAGS})
1313

1414
if(BOOST_CI_INSTALL_TEST)
15-
# Boost as a package (https://github.com/boostorg/cmake#using-boost-after-building-and-installing-it-with-cmake)
16-
find_package(Boost CONFIG REQUIRED COMPONENTS openmethod)
15+
# Header-only libraries:
16+
# B2 does not (yet) create/install CMake targets for them, so users are supposed to use the generic Boost::headers target
17+
if(BOOST_CI_INSTALLED_BY STREQUAL "B2")
18+
find_package(Boost REQUIRED)
19+
add_library(_boost_openmethod INTERFACE)
20+
target_link_libraries(_boost_openmethod INTERFACE Boost::headers)
21+
target_compile_features(_boost_openmethod INTERFACE cxx_std_17)
22+
add_library(Boost::openmethod ALIAS _boost_openmethod)
23+
else()
24+
# Boost as a package (https://github.com/boostorg/cmake#using-boost-after-building-and-installing-it-with-cmake)
25+
find_package(Boost CONFIG REQUIRED COMPONENTS openmethod)
26+
endif()
1727
elseif(BOOST_CI_INSTALL_MODULE_TEST)
1828
# Boost.OpenMethod as a package
1929
find_package(boost_openmethod CONFIG REQUIRED)

0 commit comments

Comments
 (0)