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

Fix options for C++20 experimental module in CMake #3134

Merged
merged 2 commits into from
Oct 12, 2022
Merged

Fix options for C++20 experimental module in CMake #3134

merged 2 commits into from
Oct 12, 2022

Conversation

laitingsheng
Copy link
Contributor

This PR, as discussed previously under commit 3def950, is to fix a mistake introduced in #2432 which disabled option for building the module with the new C++20 module system completely (even for compatible compiler).

Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

CMakeLists.txt Outdated
Comment on lines 67 to 70
set(FMT_CAN_MODULE OFF)
if (CMAKE_CXX_STANDARD GREATER 17 AND NOT MSVC)
set(FMT_CAN_MODULE ON)
endif ()
Copy link
Contributor

Choose a reason for hiding this comment

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

Most compiler versions don't support modules so this should be disabled by default, not enabled by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just a guard for the dependent option which will hide the option if the new module system is not available. If this is TRUE, FMT_MODULE will be the default value which is FALSE, as in the following code segment. Or otherwise, the option will be hidden completely from the user.

CMakeLists.txt Outdated
@@ -80,19 +86,13 @@ option(FMT_TEST "Generate the test target." ${FMT_MASTER_PROJECT})
option(FMT_FUZZ "Generate the fuzz target." OFF)
option(FMT_CUDA_TEST "Generate the cuda-test target." OFF)
option(FMT_OS "Include core requiring OS (Windows/Posix) " ON)
option(FMT_MODULE "Build a module instead of a traditional library." OFF)
cmake_dependent_option(FMT_MODULE "Build a module instead of a traditional library." OFF FMT_CAN_MODULE OFF)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it should be a dependent option. Users should be able to override detection if needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright, I've changed this to the simpler method, which is just excluding the MSVC, but still allowing the user to force overriding the FMT_MODULE.

@vitaut
Copy link
Contributor

vitaut commented Oct 12, 2022

I think you should replace FMT_CAN_MODULE with FMT_MODULE in test to fix CI.

@laitingsheng
Copy link
Contributor Author

replace FMT_CAN_MODULE with FMT_MODULE in test to fix CI

Thanks for the hint. I actually found the same issue from the CI logs, but I was hesitating if it's valid to replace the variable.

@vitaut vitaut merged commit 5ad7b71 into fmtlib:master Oct 12, 2022
@vitaut
Copy link
Contributor

vitaut commented Oct 12, 2022

Thank you

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