-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-477: C++20 is now a required standard.
DDS general: Modified: C++20 is now a required standard (GH-477).
- Loading branch information
1 parent
9982552
commit 828c49e
Showing
2 changed files
with
3 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It is not a good practice to set
CMAKE_*
variables unconditionally. Those are part of the CMake user interface and a project shall leave them open to be defined by the user - historically there are exceptions on rare variables, butCMAKE_CXX_STANDARD
is not one them, it is frequently set by packagers and/or users.Also it is a project-wide setting, in some scenarios, e.g. for compatibility with the ROOT C++ interpreter, global control is required. From the point of view of the DDS project, it should only set the minimally required standard based on the actual code used. CMake provides a per-target facility to express the required language dependency - compile features are also exported with the CMake package making the dependency on the required C++ flag even more explicit and automated.
So, the most idiomatic approach is to set the per-target compile feature and to not modify
CMAKE_CXX_STANDARD
at all, but only sanity-check it, if set, e.g.: https://github.com/FairRootGroup/FairMQ/blob/41ac755c573a8d214eb90af6159ef90bfc376345/cmake/FairMQProjectSettings.cmake#L21C33-L29