Changeset 19286


Ignore:
Timestamp:
10/24/18 16:39:06 (6 years ago)
Author:
tbretz
Message:
This should (hopefully) make compilation compatible with root version compiled with and without cmake.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/CMakeLists.txt

    r19276 r19286  
    88# Enable debug symbols by default
    99# must be done before project() statement
    10 SET(CMAKE_BUILD_TYPE_INIT Release) 
     10SET(CMAKE_BUILD_TYPE_INIT Release)
    1111# (you can also set it on the command line: -D CMAKE_BUILD_TYPE=Release)
    1212
     
    107107
    108108
    109 # --------- config.h -------------
    110 
    111 CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/cmake/root.rc.in"     "${PROJECT_BINARY_DIR}/.rootrc")
    112 CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/cmake/rootlogon.C.in" "${PROJECT_BINARY_DIR}/rootlogon.C")
    113 
    114 #INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}")
    115 
    116 SET(CMAKE_MODULE_PATH $ENV{ROOTSYS}/etc/cmake ${CMAKE_MODULE_PATH})
    117 
    118 
    119 # You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
    120 #   - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
    121 #   - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
    122 #LIST(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
    123 
    124 #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
     109# --------- ROOT -------------
     110
     111#IF(EXISTS "$ENV{ROOTSYS}/ROOTConfig.cmake")
     112IF(DEFINED $ENV{CMAKE_PREFIX_PATH}) # -- This is supposed to be root 6 --
     113   # You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
     114   #   - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
     115   #   - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
     116   LIST(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
     117   #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
     118   FIND_PACKAGE(ROOT REQUIRED COMPONENTS Gui Minuit ASImage HistPainter)
     119   #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
     120   INCLUDE(${ROOT_USE_FILE})
     121ELSE()
     122   # You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
     123   #   - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
     124   #   - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
     125   SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{ROOTSYS}/etc/cmake")
     126   #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
     127   FIND_PACKAGE(ROOT REQUIRED COMPONENTS Gui Minuit ASImage HistPainter)
     128   # From RootUseFile.cmake (root 6)
     129   INCLUDE_DIRECTORIES(${ROOT_INCLUDE_DIRS})
     130   LINK_DIRECTORIES(${ROOT_LIBRARY_DIR})
     131   ADD_DEFINITIONS(${ROOT_DEFINITIONS})
     132   SET(CMAKE_CXX_FLAGS     "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}")
     133   SET(CMAKE_C_FLAGS       "${CMAKE_C_FLAGS} ${ROOT_C_FLAGS}")
     134   SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ROOT_fortran_FLAGS}")
     135ENDIF()
    125136
    126137# -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree
    127138# -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread
    128139# -lASImage -lMinuit -lHistPainter -lThread
    129 
    130 FIND_PACKAGE(ROOT REQUIRED COMPONENTS Gui Minuit ASImage HistPainter)
    131 
    132140
    133141#MESSAGE("INCL_DIRS: ${ROOT_INCLUDE_DIRS}")
     
    143151#ROOT_<option>_FOUND    BOOL    True for each enabled build option (e.g. cocoa, python, xrootd, etc.)
    144152
    145 #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
    146 #INCLUDE(${ROOT_USE_FILE})
    147 
    148153# function ROOT_GENERATE_DICTIONARY( dictionary
    149154#                                    header1 header2 ...
    150155#                                    LINKDEF linkdef1 ...
    151156#                                    OPTIONS opt1...)
     157
     158CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/cmake/root.rc.in"     "${PROJECT_BINARY_DIR}/.rootrc")
     159CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/cmake/rootlogon.C.in" "${PROJECT_BINARY_DIR}/rootlogon.C")
    152160
    153161# -------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.