From 9b706bc02e4280d217d37d10a784bdd4bdcdf0d5 Mon Sep 17 00:00:00 2001 From: Mohammad Al-Turany Date: Wed, 16 May 2018 09:21:22 +0200 Subject: [PATCH] add -std=legacy to gfortran flags for version 8 --- cmake/Geant3BuildLibrary.cmake | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/cmake/Geant3BuildLibrary.cmake b/cmake/Geant3BuildLibrary.cmake index 07d2d49..d88f6cc 100644 --- a/cmake/Geant3BuildLibrary.cmake +++ b/cmake/Geant3BuildLibrary.cmake @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR) #-- ROOT (required) ------------------------------------------------------------ if(NOT ROOT_FOUND) find_package(ROOT REQUIRED) -endif(NOT ROOT_FOUND) +endif(NOT ROOT_FOUND) include_directories(${ROOT_INCLUDE_DIRS}) #------------------------------------------------------------------------------- @@ -25,7 +25,7 @@ include_directories(${ROOT_INCLUDE_DIRS}) include_directories( ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/minicern - ${PROJECT_SOURCE_DIR}/TGeant3 + ${PROJECT_SOURCE_DIR}/TGeant3 ${CMAKE_CURRENT_BINARY_DIR}) #------------------------------------------------------------------------------- @@ -58,7 +58,7 @@ set(directories # Fortran sources set(fortran_sources gcinit.F) foreach(_directory ${directories}) - file(GLOB add_f_sources + file(GLOB add_f_sources ${PROJECT_SOURCE_DIR}/${_directory}/*.F) list(APPEND fortran_sources ${add_f_sources}) endforeach() @@ -69,11 +69,11 @@ list(REMOVE_ITEM fortran_sources ${PROJECT_SOURCE_DIR}/gtrak/grndm.F) list(REMOVE_ITEM fortran_sources ${PROJECT_SOURCE_DIR}/gtrak/grndmq.F) list(REMOVE_ITEM fortran_sources ${PROJECT_SOURCE_DIR}/erdecks/eustep.F) #message(STATUS "fortran_sources ${fortran_sources}") - + # C sources set(c_sources) foreach(_directory ${directories}) - file(GLOB add_c_sources + file(GLOB add_c_sources ${PROJECT_SOURCE_DIR}/${_directory}/*.c) list(APPEND c_sources ${add_c_sources}) endforeach() @@ -81,13 +81,13 @@ list(APPEND c_sources ${PROJECT_SOURCE_DIR}/minicern/lnxgs/ishftr.c) # Linux specific, the file is kept on macosx, macosx64) list(REMOVE_ITEM c_sources ${PROJECT_SOURCE_DIR}/minicern/lnblnk.c) #message(STATUS "c_sources ${c_sources}") - + # C++ sources -file(GLOB cxx_sources +file(GLOB cxx_sources ${PROJECT_SOURCE_DIR}/comad/gcadd.cxx ${PROJECT_SOURCE_DIR}/TGeant3/*.cxx) #message(STATUS "cxx_sources ${cxx_sources}") - + #------------------------------------------------------------------------------- # Locate headers for this project # @@ -105,6 +105,13 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -finit-local-zero -fno-strict-ov # -DCERNLIB_DECS (alphagcc, alphacxx6) # -DCERNLIB_SUN (solarisCC5) # -DCERNLIB_HPUX (hpuxacc) + +if (${CMAKE_Fortran_COMPILER} MATCHES gfortran+) + if (${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER_EQUAL "8") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -std=legacy") + endif() +endif() + if (CMAKE_SIZEOF_VOID_P EQUAL 8) add_definitions(-DCERNLIB_LXIA64) else()