-
Notifications
You must be signed in to change notification settings - Fork 308
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 -DCMAKE_CXX_STANDARD ignored by CMakeLists #273
Conversation
Add CACHE to setting CMAKE_CXX_STANDARD to allow for the user to override the default value.
…eLists Fix set not having proper arguments
set(CMAKE_CXX_STANDARD 11) | ||
# this than assuming what absl used. | ||
# Using CACHE allows the user to override the default. | ||
set(CMAKE_CXX_STANDARD 11 CACHE STRING "The C++ standard to build with") |
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.
#270 (comment) suggests option
. What's the difference between set(CACHE)
and option
/ when would I want to use one or the other? @jievince
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.
Hi @jmr, I am unfamiliar with CMake, and I don't know the difference between them. I just tried option
, and it works.
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.
Hi @LafeWessel, can you explain it?
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.
Based on the documentation, both option
and set(CACHE)
seem to do about the same thing.
https://cmake.org/cmake/help/latest/command/set.html#set-cache-entry
https://cmake.org/cmake/help/latest/command/option.html
However, based on the description of set(CACHE)
, it seems proper to use it instead of option
in this use case. From the docs:
Sets the given cache (cache entry). Since cache entries are meant to provide user-settable values this does not overwrite existing cache entries by default. Use the FORCE option to overwrite existing entries.
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.
LGTM
The command line argument for setting the C++ standard to use is ignored. This change allows the default to remain 11 but allow for the user to override it.
Resolve #270