Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMAKE_CXX_STANDARD should be c++20 if SPDLOG_USE_STD_FORMAT is set #2400

Closed
mdavis199 opened this issue Jun 9, 2022 · 4 comments
Closed

Comments

@mdavis199
Copy link

By default, spdlog sets CMAKE_CXX_STANDARD 11. However, if the option SPDLOG_USE_STD_FORMAT is ON, the required standard should be 17 or higher, because std::string_view is required.

This can cause problems when using package managers such as vcpkg or conan. To enable SPDLOG_USE_STD_FORMAT, package managers need to patch spdlog's CMakelist.txt.

I suggest that spdlog's CMakeLists.txt should specify the CMAKE_CXX_STANDARD through target_compile_features based on the value of SPDLOG_USE_STD_FORMAT.

@tt4g
Copy link
Contributor

tt4g commented Jun 10, 2022

Right. PR is welcome.

Workaround. if we specify cmake -DCMAKE_CXX_STANDARD=20 (other options...) at build time, the problem should not appear.

@cookcocck
Copy link
Contributor

@mdavis199
What if we specify CMAKE_CXX_STANDARD by target_compile_features, but also want to pass the parameter via cmake -DCMAKE_CXX_STANDARD?

@gabime gabime changed the title CMAKE_CXX_STANDARD is not set properly for spdlog's options CMAKE_CXX_STANDARD should be c++20 if SPDLOG_USE_STD_FORMAT is set Jun 13, 2022
@cookcocck
Copy link
Contributor

@tt4g Could you please check my PR?
#2402

@sylveon
Copy link
Contributor

sylveon commented Jul 23, 2022

Seems like this can be closed

@gabime gabime closed this as completed Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants