Skip to content

Feature/use file set headers#46

Open
ClausKlein wants to merge 6 commits intoboostorg:developfrom
ClausKlein:feature/use-file_set-headers
Open

Feature/use file set headers#46
ClausKlein wants to merge 6 commits intoboostorg:developfrom
ClausKlein:feature/use-file_set-headers

Conversation

@ClausKlein
Copy link
Copy Markdown

Make import std; usable

Add FILE_SET HEADERS too support generic module installation

Add FILE_SET HEADERS too support generic installation
Comment thread CMakeLists.txt
# -----------------------------------------------------------------------------
# User option: enable C++ modules
# -----------------------------------------------------------------------------
option(BOOST_USE_MODULES "Build Boost using C++ modules" OFF)
Copy link
Copy Markdown
Member

@apolukhin apolukhin Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread CMakeLists.txt

# Ensure CMAKE_CXX_STANDARD is set for module detection
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 20)
Copy link
Copy Markdown
Member

@apolukhin apolukhin Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it right to set this variable from CMakeLists? Can we stick to using feature flags only?

Comment thread CMakeLists.txt
add_library(boost_type_index INTERFACE)

# If modules are disabled, require C++17 for headers
target_compile_features(boost_type_index INTERFACE cxx_std_17)
Copy link
Copy Markdown
Member

@apolukhin apolukhin Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cxx_std_11
Library supports C++11

Comment thread CMakeLists.txt

# Verify interface headers only at top level
if(PROJECT_IS_TOP_LEVEL)
set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ON)
Copy link
Copy Markdown
Member

@apolukhin apolukhin Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://cmake.org/cmake/help/latest/variable/CMAKE_VERIFY_INTERFACE_HEADER_SETS.html#variable:CMAKE_VERIFY_INTERFACE_HEADER_SETS

Projects should not normally set this variable, it is intended as a developer control to be set on the [cmake(1)](https://cmake.org/cmake/help/latest/manual/cmake.1.html#manual:cmake(1)) command line or other equivalent methods

Maybe we should set this variable in CI only?

Comment thread CMakeLists.txt
TYPE HEADERS
BASE_DIRS include
FILES
include/boost/type_index.hpp
Copy link
Copy Markdown
Member

@apolukhin apolukhin Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about searching the files via GLOB?

target_link_libraries(boost_type_index_module_usage_mu PRIVATE Boost::type_index)
add_test(NAME boost_type_index_module_usage_mu COMMAND boost_type_index_module_usage_mu)
else()
list(APPEND RUN_TESTS_SOURCES
Copy link
Copy Markdown
Member

@apolukhin apolukhin Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it in the else now?


#ifndef BOOST_TYPE_INDEX_USE_STD_MODULE
#ifdef BOOST_TYPE_INDEX_USE_STD_MODULE
import std;
Copy link
Copy Markdown
Member

@apolukhin apolukhin Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like import std; should not be used in global module fragment https://eel.is/c++draft/module#global.frag-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants