# ********************************* # ************ cmake ************** # ********************************* CMAKE_MINIMUM_REQUIRED(VERSION 2.6) CMAKE_POLICY(SET CMP0043 NEW) CMAKE_POLICY(SET CMP0048 NEW) # Enable debug symbols by default # must be done before project() statement IF (NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE) ENDIF() # (you can also set it on the command line: -D CMAKE_BUILD_TYPE=Release) # Enable CLANG as default compilers, to change this use # cmake -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++ # Note that if compilers are switched on the fly, # the cache is deleted IF (NOT DEFINED CMAKE_C_COMPILER) SET(CMAKE_C_COMPILER "clang")# CACHE STRING "Choose the compiler (c++, g++, clang++)" FORCE) ENDIF() # IF (NOT DEFINED CMAKE_CXX_COMPILER) SET(CMAKE_CXX_COMPILER "clang++")# CACHE STRING "Choose the compiler (c++, g++, clang++)" FORCE) ENDIF() #SET(CMAKE_VERBOSE_MAKEFILE ON) # To check for an include file you do this: #CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H) # To check the size of a primitive type: #CHECK_TYPE_SIZE("int" SIZEOF_INT) # ********************************* # ************ Project ************ # ********************************* STRING(TIMESTAMP VERSION %y.%U.%w.%H UTC) MESSAGE(STATUS "Mars V${VERSION}") PROJECT(mars VERSION ${VERSION}) INCLUDE(GNUInstallDirs) # ======== For config.h.in ========= SET(PACKAGE_MAINTAINER "Thomas Bretz") SET(PACKAGE_BUGREPORT "tbretz@physik.rwth-aachen.de") SET(PACKAGE_URL "https://www.fact-project.org") # ********************************* # ********* Requirements ********** # ********************************* # =========== help2man ============ FIND_PROGRAM(HELP2MAN_EXECUTABLE help2man) # =========== pkg-config ============ FIND_PACKAGE(PkgConfig) FIND_PACKAGE(PackageHandleStandardArgs) # ============= libnova ============== PKG_CHECK_MODULES(Nova Nova) # Try to locate the package in the default path # and in the path provided by pkg-config FIND_PATH(NOVA_INCLUDE_DIR NAMES libnova/libnova.h PATHS ${NOVA_INCLUDE_DIRS}) FIND_LIBRARY(NOVA_LIBRARY NAMES nova PATHS ${NOVA_LIBRARY_DIRS}) # Check if NOVA_LIBARARY and NOVA_INCLUDE_DIR is set # Print a message otherwise FIND_PACKAGE_HANDLE_STANDARD_ARGS(Nova DEFAULT_MSG NOVA_LIBRARY NOVA_INCLUDE_DIR) # Mark those variables to be displayed as 'advanced' in the GUI MARK_AS_ADVANCED(NOVA_LIBRARY NOVA_INCLUDE_DIR) # handle success IF(NOVA_FOUND AND NOT NOVA_FIND_QUIETLY) MESSAGE(STATUS "Found Nova ${NOVA_LIBRARY} in ${NOVA_INCLUDE_DIR}") ENDIF() # ============== libz ================ FIND_PACKAGE(ZLIB REQUIRED) # =========== Enable C++11 =========== SET(CMAKE_CXX_STANDARD 11) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Winit-self -Wpointer-arith \ -Wcast-align -Wformat -Woverloaded-virtual \ -Wnon-virtual-dtor -Wshadow -fPIC") # -Wextra SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ -DMARSVER=\\\"1.0\\\" -D_REENTRANT -D__MARS__ -D__LINUX__ \ -DPACKAGE_VERSION=\\\"1.0\\\" -DREVISION=\\\"1.0\\\" \ -DPACKAGE_NAME=\\\"MARS\\\" -DHAVE_ZLIB") # --------- config.h ------------- #CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/config.h.in" "${PROJECT_BINARY_DIR}/config.h") #INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}") SET(CMAKE_MODULE_PATH $ENV{ROOTSYS}/etc/cmake ${CMAKE_MODULE_PATH}) # You need to tell CMake where to find the ROOT installation. This can be done in a number of ways: # - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake # - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT #LIST(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS}) #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS) # -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree # -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread # -lASImage -lMinuit -lHistPainter -lThread FIND_PACKAGE(ROOT REQUIRED COMPONENTS Gui Minuit) #MESSAGE("INCL_DIRS: ${ROOT_INCLUDE_DIRS}") #MESSAGE("LIBS: ${ROOT_LIBRARIES}") #MESSAGE("DEFS: ${ROOT_DEFINITIONS}") #MESSAGE("CXXFLAGS: ${ROOT_CXX_FLAGS}") #MESSAGE("CXFLAGS: ${ROOT_CC_FLAGS}") #MESSAGE("FOUND: ${ROOT_FOUND}") #MESSAGE("FILE: ${ROOT_USE_FILE}") #MESSAGE("DIR: ${CMAKE_CURRENT_SOURCE_DIR}") #ROOT__LIBRARY PATH Full path for each of the ROOT libraries listed in COMPONENTS #ROOT__CMD PATH Full path for each ROOT executable (rootcling, root, hadd, etc.) #ROOT_