Commit d47e67b7 authored by Håkan Wennlöf's avatar Håkan Wennlöf Committed by Simon Spannagel
Browse files

Added precompiler check for Geant4 version, as G4FindDataDir() doesn't exist in older ones

(cherry picked from commit a8c7c207)
parent c9c89eb4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -93,7 +93,11 @@ GeometryBuilderGeant4Module::GeometryBuilderGeant4Module(Configuration& config,
 * @throws ModuleError If a certain Geant4 dataset is not set or not available
 */
static void check_dataset_g4(const std::string& env_name) {
#if G4VERSION_NUMBER > 1100
    const char* file_name = G4FindDataDir(env_name.c_str());
#else
    const char* file_name = std::getenv(env_name.c_str());
#endif
    if(file_name == nullptr) {
        throw ModuleError("Geant4 environment variable " + env_name +
                          " is not set, make sure to source a Geant4 "