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

Passing custom (newer) C++ standard in cmake #90

Open
NikolausDemmel opened this issue Jan 14, 2019 · 1 comment
Open

Passing custom (newer) C++ standard in cmake #90

NikolausDemmel opened this issue Jan 14, 2019 · 1 comment

Comments

@NikolausDemmel
Copy link
Contributor

In the cmake configuration the CXX_STANDARD property of the library is set to a fixed value of 11.

CXX_STANDARD 11

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 the CMakeLists.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 if CMAKE_CXX_STANDARD is set. If yes, we use that, if not, we default to 11. Would that be an acceptable change, or does that have possible downsides?

@NikolausDemmel
Copy link
Contributor Author

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.

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

No branches or pull requests

1 participant