Changeset 19362


Ignore:
Timestamp:
11/08/18 11:35:46 (6 years ago)
Author:
tbretz
Message:
Improved the detection of root. This hopefully works now also with an installtion in the OS prefix path.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/CMakeLists.txt

    r19325 r19362  
    238238# --------- ROOT -------------
    239239
     240FIND_PROGRAM(ROOTCONFIG_EXECUTABLE NAMES root-config)
     241FIND_PACKAGE_HANDLE_STANDARD_ARGS(root-config DEFAULT_MSG ROOTCONFIG_EXECUTABLE)
     242IF(NOT ROOTCONFIG_EXECUTABLE)
     243   MESSAGE(FATAL_ERROR "Please make sure `root-config` is accessible in your path. In case of an installation from source, you might need to source\n . [path-to-root]/bin/thisroot.sh")
     244ENDIF()
     245
    240246# You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
    241247#   - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
    242248#   - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
    243 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{ROOTSYS}/etc/cmake")
     249IF(EXISTS $ENV{ROOTSYS}/ROOTConfig.cmake)
     250   IF(NOT DEFINED ENV{CMAKE_PREFIX_PATH})
     251      LIST(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
     252   ENDIF()
     253ELSE()
     254   SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{ROOTSYS}/etc/cmake")
     255ENDIF()
    244256
    245257#---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
     
    250262ENDIF()
    251263
     264#---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
    252265IF(NOT DEFINED ROOT_CONFIG_EXECUTABLE)
    253    FIND_PACKAGE_MESSAGE(RootFound "Found ROOT: ${ROOT_INCLUDE_DIRS}" "[${ROOT_INCLUDE_DIRS}][${ROOT_LIBRARY_DIR}]")
     266   FIND_PACKAGE_MESSAGE(RootFound "Found ROOT: ${ROOT_INCLUDE_DIRS} [${ROOT_VERSION}]" "[${ROOT_INCLUDE_DIRS}][${ROOT_LIBRARY_DIR}][${ROOT_VERSION}]")
    254267ENDIF()
    255268
     
    267280   SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ROOT_fortran_FLAGS}")
    268281ENDIF()
    269 
    270282
    271283# -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree
Note: See TracChangeset for help on using the changeset viewer.