-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Cpp target: allow building runtime with newer C++ standards #3071
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,8 @@ if(ANTLR4_ZIP_REPOSITORY) | |
CMAKE_CACHE_ARGS | ||
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||
-DWITH_STATIC_CRT:BOOL=${ANTLR4_WITH_STATIC_CRT} | ||
# -DCMAKE_CXX_STANDARD:STRING=17 # if desired, compile the runtime with a different C++ standard | ||
# -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} # alternatively, compile the runtime with the same C++ standard as the outer project | ||
INSTALL_COMMAND "" | ||
EXCLUDE_FROM_ALL 1) | ||
else() | ||
|
@@ -104,6 +106,8 @@ else() | |
CMAKE_CACHE_ARGS | ||
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||
-DWITH_STATIC_CRT:BOOL=${ANTLR4_WITH_STATIC_CRT} | ||
# -DCMAKE_CXX_STANDARD:STRING=17 # if desired, compile the runtime with a different C++ standard | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This setting should not be done in the cmake file, but be set by the outer project which needs to build ANTLR4. As such it makes not so much sense to have this here, even if it is only a comment. Additionally, it should be documented somewhere (readme). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can tell, ExternalProject_Add() runs in a separate CMake instance, and does not use the same args as the outer project. So I've had to pass the build arguments explicitly here. Either way, you're right, I have to update the readme - will do. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replacing the snippet above with |
||
# -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} # alternatively, compile the runtime with the same C++ standard as the outer project | ||
INSTALL_COMMAND "" | ||
EXCLUDE_FROM_ALL 1) | ||
endif() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you want to disable CXX extensions? Is there a rational behind this decision?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The runtime doesn't need/builds without GNU C++ Extensions.
(And that's a good thing, because e.g. Clang might not support (all) the GNU C++ extensions).
So I feel like it's good to make it explicit, but I'm ok with reverting the change if you want.