Does anyone know the proper (best, official, etc.) way to build Geant4 applications with C++17?
Specifically, my Geant4 application (a.k.a. use code) requires use an up-to-date ROOT version (I have 6.18.04b) whose TString class requires C++17 (uses std::string_view).
From some discussions by the developers, it was clear that Geant4’ source files are compatible with C++17 and that a sane solution starts with building Geant using the same C++ standard.
(before that, I used the default Unix build, so make stuck in std==c++11 twice when building each source code).
The official PDF installation guide pointed my to the right CMake option:
cmake -DGEANT4_BUILD_CXXSTD=17 …
and this worked fine.
Except my application was still building with std=c++11.
So in addition to my usual hack of binmake.gmk (*) , I also ended up hacking architecture.gmk by replacing the lines hard-coding the use of c++11 with similiar lines for c++17. This worked.
(*) it allows user-supplied flags after the LDLIBS, so that even the application’s main can use the ROOT libraries
Surely there’s a better way. Right?