When using Geant4 to build some test/examples of GeantV we get the following errors. We do configure GeantV with -DCMAKE_CXX_STANDARD=14 and Geant4 has been build with -DGEANT4_BUILD_CXXSTD=c++14. -- Configuring done CMake Error in run/scheduler/CMakeLists.txt: Specified unknown feature "cxx_std_14" for target "TestEm5_GV". CMake Error in run/scheduler/CMakeLists.txt: Specified unknown feature “cxx_std_14" for target "TestEm3_GV" … The problem comes that I am using CMake version 3.7.x and these CMake compiler features are not known. The solution is to move to version 3.8 but this implies that Geant4 not usable with less than 3.8. Is this a wanted feature or a bug? I would think is the second. Can you confirm?
Saw the ticket... cut&pasting here! Hi Pere, certainly, Ben can better comment.. But isn't the feature itself 'cxx_std_14' directly set by CMake ? It seems to me a limitation of that specific version of CMake. Is it possible ? I think the same 'problem' applies with c++17 which we recently enabled as we were requested for that. We are allowing selection of c++17 but do not force checks on the minimum CMake version to be used (3.3 is the minimum we currently support, but one need at least 3.8 in order for CMake to understand c++17). The alternative would be to throw an error immediately at configuration, by forcing the minimum version of CMake to be 3.8 also for people not requesting c++14 or c++17.. Gabriele
Indeed, the "meta features" for the C++ standard are only set in CMake 3.8 and above. They get set for 14/17 because the logic in these cases is to set all known features for the standard. Since the meta features appear in that list, they get added. I'd therefore agree it's a bug - in the immediate GeantV use case, it may be possible to work around it by adding the feature directly to the list of known features (but I have to test this first to give a clear answer). For patches, we can simply filter out "cxx_std_14", but leave "cxx_std_!7". Gabriele is right that we should also look at setting/checking a minimum CMake version with which the Geant4Config files are compatible!
As far as I understood, Pere correct me if I'm wrong, Pere was using a pre-built installation of Geant4 from the LCG build, which was installed with a version of CMake >= 3.8 and with c++14 enabled. Then, tried to build GV using CMake 3.7 and getting those errors.
This will be fixed with the move to require a minimum version of CMake 3.12 for building Geant4, and as part of that we'll define the minimum CMake version needed to use a build/install.
Now fixed in master in MR 608, which enforces the minimum CMake version at both build and use time.