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

Use recommended way to set the c++ standard via cmake #11

Merged

Conversation

tmadlener
Copy link
Contributor

Use the recommended CMAKE_CXX_STANDARD to set the c++ standard instead of adding it to the CMAKE_CXX_FLAGS. Leave the default at 17 and for now only allow 17 and 20.

Effectively the same change as PandoraPFA/PandoraSDK#16

Copy link
Collaborator

@AndyChappell AndyChappell left a comment

Choose a reason for hiding this comment

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

Hi Thomas, thanks again for the proposed changes. Similar comment to the other PRs.

CMakeLists.txt Outdated
Comment on lines 40 to 42
if(NOT CMAKE_CXX_STANDARD MATCHES "17|20")
message(FATAL_ERROR "Unsupported C++ standard: ${CMAKE_CXX_STANDARD}")
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi Thomas, thanks again. The comment here is the same as elsewhere. The default standard is fine, but the restriction should be avoided to allow for overrides at build time.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @AndyChappell

Could you clarify what you mean by build time?

Can't you always do "CXXFLAGS=-std=c++23 make" to change this at build time?

Or do you mean at configure time during the cmake run?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @andresailer , yes, in this case, most particularly cmake configuration. You can set the standard with an additional flag, however, this conditional expression would then veto the use of, say, C++23, so I think this if block should be avoided.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mainly put this validation here to avoid some potential issues. We can adjust that to whatever you deem suitable (or remove it entirely). The main point with this series of pull requests was to switch to CMAKE_CXX_STANDARD for setting the c++ standard as that is the recommended way to do it (and is also what many build tools use to set it) instead of putting it into the CMAKE_CXX_FLAGS. Would you accept that simplified set of changes?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @tmadlener, yes, the updates to use CMAKE_CXX_STANDARD with a default of 17 are completely fine, it's really only the few lines highlighted in the comment that are problematic (plus the requested style change in the SDK PR), so if those are removed the remaining changes should be fine.

Copy link
Collaborator

@AndyChappell AndyChappell left a comment

Choose a reason for hiding this comment

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

Change looks good, thanks.

@AndyChappell AndyChappell changed the base branch from master to feature/cmake_update January 6, 2025 11:57
@AndyChappell AndyChappell merged commit b8f81b5 into PandoraPFA:feature/cmake_update Jan 6, 2025
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.

3 participants