Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
cd ..
rm -rf __build

- name: Run modules tests wihtout 'import std;'
- name: Run modules tests without 'import std;'
if: ${{matrix.toolset == 'clang-19'}}
run: |
cd ../boost-root/libs/any
Expand Down Expand Up @@ -218,7 +218,7 @@ jobs:
cd ..
rm -rf build_module

- name: Run modules tests wihtout 'import std;'
- name: Run modules tests without 'import std;'
if: ${{matrix.toolset == 'msvc-14.3'}}
shell: cmd
run: |
Expand Down
13 changes: 9 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt

cmake_minimum_required( VERSION 3.5...3.31 )
cmake_minimum_required( VERSION 3.8...3.31 )
project( boost_any VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX )

if (BOOST_USE_MODULES)
add_library(boost_any)
target_sources(boost_any PUBLIC
FILE_SET modules_public TYPE CXX_MODULES FILES
${CMAKE_CURRENT_LIST_DIR}/modules/boost_any.cppm
FILE_SET modules_public
TYPE CXX_MODULES
FILES modules/boost_any.cppm
)

target_compile_features(boost_any PUBLIC cxx_std_20)
target_compile_definitions(boost_any PUBLIC BOOST_USE_MODULES)
if (CMAKE_CXX_COMPILER_IMPORT_STD)
set(__boost_cxx_standard ${CMAKE_CXX_STANDARD})
if (NOT __boost_cxx_standard)
set(__boost_cxx_standard 20)
endif()
if (CMAKE_CXX_COMPILER_IMPORT_STD AND ${__boost_cxx_standard} IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD)
target_compile_definitions(boost_any PRIVATE BOOST_ANY_USE_STD_MODULE)
message(STATUS "Using `import std;`")
else()
Expand Down
5 changes: 2 additions & 3 deletions test/cmake_subdir_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ add_subdirectory(../../../detail boostorg/detail)
add_subdirectory(../../../integer boostorg/integer)
add_subdirectory(../../../mp11 boostorg/mp11)
add_subdirectory(../../../preprocessor boostorg/preprocessor)
add_subdirectory(../../../static_assert boostorg/static_assert)
add_subdirectory(../../../throw_exception boostorg/throw_exception)
add_subdirectory(../../../type_index boostorg/type_index)
add_subdirectory(../../../type_traits boostorg/type_traits)
Expand All @@ -25,7 +24,7 @@ add_subdirectory(../../ boostorg/any)
enable_testing()

if (BOOST_USE_MODULES)
add_executable(boost_any_module_usage ../modules/usage_sample.cpp)
add_executable(boost_any_module_usage ../../modules/usage_sample.cpp)
target_link_libraries(boost_any_module_usage PRIVATE Boost::any)
add_test(NAME boost_any_module_usage COMMAND boost_any_module_usage)
endif()
Expand All @@ -50,7 +49,7 @@ list(APPEND RUN_TESTS_SOURCES
foreach (testsourcefile ${RUN_TESTS_SOURCES})
get_filename_component(testname ${testsourcefile} NAME_WLE)
add_executable(${PROJECT_NAME}_${testname} ../${testsourcefile})
target_link_libraries(${PROJECT_NAME}_${testname} Boost::any)
target_link_libraries(${PROJECT_NAME}_${testname} Boost::any Boost::core)
add_test(NAME ${PROJECT_NAME}_${testname} COMMAND ${PROJECT_NAME}_${testname})
endforeach()