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

[cmake] allow to override the cxx standard #120

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

fabiencastan
Copy link
Contributor

When using multiple libraries using eigen, they all need to agree on the way we use memory alignment in eigen.
See https://eigen.tuxfamily.org/dox/group__TopicStlContainers.html
As we have moved to C++17, we need all libraries using eigen to be compatible with that.

The solution is simple: define a cmake cached variable, so it can be overriden.

This PR also add some missing includes, needed to build with g++ 10.

@@ -181,8 +184,6 @@ add_library( random_generators test/random_generators.cpp test/random_generators
set_target_properties( opengv random_generators PROPERTIES
SOVERSION ${PROJECT_VERSION}
VERSION ${PROJECT_VERSION}
CXX_STANDARD 11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing at line 333 below for the tests

@@ -181,8 +184,6 @@ add_library( random_generators test/random_generators.cpp test/random_generators
set_target_properties( opengv random_generators PROPERTIES
SOVERSION ${PROJECT_VERSION}
VERSION ${PROJECT_VERSION}
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
DEBUG_POSTFIX d )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DEBUG_POSTFIX d )
)

For DEBUG_POSTFIXwe can just set a cache variable that initialize CMAKE_DEBUG_POSTFIX that will automatically set it for all targets, without doing it explicitly:

set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "The postfix to use for the debug version of the target names")

from gcc documentation: "-march=cpu-type allows GCC to generate code
that may not run at all on processors other than the one indicated."
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