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

Set C++ standard only if it is not set at parent scope #3541

Merged
merged 1 commit into from
Sep 29, 2022

Conversation

vlstill
Copy link
Contributor

@vlstill vlstill commented Sep 29, 2022

This change allows cleaner inclusion of p4c into projects that set CMAKE_CXX_STANDARD to value greater then 11, it does not change anything if p4c is built standalone.

Essentially, in Intel we have top-level target that includes p4c and p4c then includes our extensions. We build our extensions with C++17, but we would like to build p4c with C++17 too to avoid having some code compiled with older standard. In particular, problem can be in the code that is built as part of p4c, but is coming from extensions (such as additional IR defs). With this change, we would be able to use C++17 cleanly.

Of course, anyone setting CMAKE_CXX_STANDARD > 11 takes the risk it will break something in p4c. This risk is very small for C++17 (bigger for C++20 if anyone would be brave enough to try it).

@vlstill vlstill merged commit e31d8c6 into main Sep 29, 2022
@fruffy fruffy deleted the vstill/allow-newer-std branch October 23, 2022 22:01
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