Open NikolausDemmel opened 5 years ago
Looks like the proper modern cmake way is something like
target_compile_features(opengv PUBLIC cxx_std_11)
which according to a quick test can be overwritten by setting CMAKE_CXX_STANDARD
. Unfortunately that is a cmake 3.8+ feature.
In the cmake configuration the
CXX_STANDARD
property of the library is set to a fixed value of11
.https://github.com/laurentkneip/opengv/blob/306a54e6c6b94e2048f820cdf77ef5281d4b48ad/CMakeLists.txt#L184
I'm building opengv as part of my project and would like to set a different (newer) C++ standard from outside. However, currently passing
CMAKE_CXX_STANDARD
does nothing and is overwritten. As a workaround I modify theCMakeLists.txt
, but ideally I would like to pull in the unmodified upstream version.Is there currently a way to pass a custom C++ standard version from "outside"?
What would be a good way to implement this? Instead of putting a fixed value of
11
, we could check ifCMAKE_CXX_STANDARD
is set. If yes, we use that, if not, we default to11
. Would that be an acceptable change, or does that have possible downsides?