Skip to content

Conversation

@Flamefire
Copy link
Contributor

cxx_std_11 requires CMake 3.8

@Lastique
Copy link
Member

Lastique commented Oct 1, 2025

cxx_std_11 is not used in Boost.Filesystem. Why is this needed?

@Flamefire
Copy link
Contributor Author

It should be used because the library requires C++11, see the Jamfile:

filesystem/build/Jamfile.v2

Lines 132 to 142 in ce7a835

cxx11_rvalue_references
cxx11_scoped_enums
cxx11_noexcept
cxx11_nullptr
cxx11_defaulted_functions
cxx11_defaulted_moves
cxx11_deleted_functions
cxx11_function_template_default_args
cxx11_unified_initialization_syntax
cxx11_final
cxx11_override

It doesn't fail without it though because this gets added by a dependency already which is what causes the error in the dependency and Boost.Filesystem.

@Lastique
Copy link
Member

Lastique commented Oct 1, 2025

It should be used because the library requires C++11, see the Jamfile

This is reflected in CMake here:

target_compile_features(boost_filesystem PUBLIC
cxx_rvalue_references
cxx_strong_enums
cxx_noexcept
cxx_nullptr
cxx_defaulted_functions
cxx_defaulted_move_initializers
cxx_deleted_functions
cxx_default_function_template_args
cxx_final
cxx_override
)

I believe, the dependency that requires it is Boost.Atomic, but that got recently fixed. Do you still have the issue after that fix was applied?

@Flamefire
Copy link
Contributor Author

I missed that, sorry.

I believe, the dependency that requires it is Boost.Atomic, but that got recently fixed. Do you still have the issue after that fix was applied?

Do you mean boostorg/atomic#78 ? That means to build Boost.Atomic you (declare to) need CMake 3.8, and as FileSystem requires Atomic it needs CMake 3.8 too.

The error here shows because cxx_std_11 is added to boost_filesystem by boost_atomic so CMake shows the error for both targets.

You can also simplify the list to just cxx_std_11 as you'll get that anyway.

@Lastique
Copy link
Member

Lastique commented Oct 1, 2025

The thing is if CMake < 3.8 is used to build Boost.Filesystem, it should fail at Boost.Atomic, as expected. There's nothing in Boost.Filesystem itself that requires 3.8, so it should not be an error to specify 3.5. Projects should not be required to track the max min required CMake version across their dependency tree, it's CMake's job to figure that out. I consider this a CMake issue.

Anyway, raising the min version is not really a problem, if it works around the issue. Thanks again.

@Lastique Lastique merged commit 3420809 into boostorg:develop Oct 1, 2025
47 of 49 checks passed
@Flamefire Flamefire deleted the fix-cmake-version branch October 1, 2025 14:41
@Flamefire
Copy link
Contributor Author

The thing is if CMake < 3.8 is used to build Boost.Filesystem, it should fail at Boost.Atomic, as expected.

With boostorg/atomic#78 it now does. It didn't before and I simply opened PRs in each repo where CMake showed the unknown feature w/o checking if that feature was used by the library itself or a dependency as I wasn't aware it would verify features so late the error shows up in dependents too.

With "as FileSystem requires Atomic it needs CMake 3.8 too." I didn't want to say that you need to declare that you need CMake 3.8 as done in this PR but that you effectively do require CMake 3.8 because otherwise configuring Filesystem will fail while configuring the Atomic dependency.
So there is no real change by changing the minimum version here.

But: As you effectively need CMake 3.8 anyway you can replace that long list with cxx_std_11 and directly declare the 3.8 requirement as done in this PR.

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