Problem 2044 - Using Geant4 10.4 requires CMake >= 3.8
Summary: Using Geant4 10.4 requires CMake >= 3.8
Status: CLOSED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: cmake (show other problems)
Version: 10.4
Hardware: All All
: P4 minor
Assignee: Ben Morgan
URL:
Depends on:
Blocks:
 
Reported: 2018-03-15 14:29 CET by Pere Mato
Modified: 2019-11-01 11:58 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Pere Mato 2018-03-15 14:29:20 CET
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?
Comment 1 Gabriele Cosmo 2018-03-15 15:40:28 CET
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
Comment 2 Ben Morgan 2018-03-15 17:09:42 CET
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!
Comment 3 Gabriele Cosmo 2018-03-16 07:53:44 CET
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.
Comment 4 Ben Morgan 2019-07-09 12:20:35 CEST
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.
Comment 5 Ben Morgan 2019-11-01 11:58:27 CET
Now fixed in master in MR 608, which enforces the minimum CMake version at both build and use time.