#### EDITED FOR LINUX - C. Sotty # 08 Nov 2017 #---------------------------------------------------------------------------- # Setup the project SET(ROOT_DIR "/home/sotty/Codes_Installed_by_CS/root/root-6.10.08-build/lib/") cmake_minimum_required(VERSION 3.0 FATAL_ERROR) project(statusBar) message(STATUS "Project: statusBar") #Set the C++ standard to c++11 #message("Your C++ compiler supports these C++ features:") #foreach(i ${CMAKE_CXX_COMPILE_FEATURES}) # message(" ${i}") #endforeach() if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # require at least gcc 4.8 if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) message(FATAL_ERROR "GCC version must be at least 4.8!") if (CMAKE_CXX_COMPILER_VERSION VERSION_MORE 5.4) message(WARNING "You are using an unsupported compiler! Compilation has only been tested up to version 5.4") endif() endif() #elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") # # require at least clang 3.2 # if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.2) # message(FATAL_ERROR "Clang version must be at least 3.2!") # endif() else() #message(WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang and GCC.") message(WARNING "You are using an unsupported compiler! Compilation has only been tested with GCC.") endif() set (CMAKE_CXX_STANDARD 14) message(STATUS "Compiling with -std=c++14") #NO WARNING FLAGS (C. Sotty) set (CMAKE_CXX_FLAGS "-w") # 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) find_package(ROOT REQUIRED COMPONENTS RIO Net) if(${ROOT_FOUND}) message(STATUS "Installation of ROOT found: ----> root-${ROOT_VERSION}") if(${ROOT_VERSION} VERSION_GREATER "6.0") message(STATUS "ROOT_VERSION >= 6.0 YES") else() message(STATUS "ROOT_VERSION >= 6.0 NO") message(SEND_ERROR "The ROOT Version has to be >= 6.0") return() endif() else() message(SEND_ERROR "No Installation of ROOT found") return() endif() #---------------------------------------------------------------------------- # Setup include directory for this project include(${ROOT_USE_FILE}) include_directories(${ROOT_INCLUDE_DIRS}) link_directories(${ROOT_LIBRARY_DIR}) include_directories(include) #add_subdirectory(src) #include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) #ROOT_GENERATE_DICTIONARY(G__CSpec CSpec.h LINKDEF CSpecLinkDef.h) #---------------------------------------------------------------------------- #Create a shared library with geneated dictionary #add_library(CSpec SHARED CSpec.cxx) #target_link_libraries(CSpec ${ROOT_LIBRARIES}) #target_link_libraries(CSpec /home/sotty/Codes_Installed_by_CS/root/root-6.10.08-build/lib/libTree.so) #target_link_libraries(CSpec /home/sotty/Codes_Installed_by_CS/root/root-6.10.08-build/lib/libRIO.so) #target_link_libraries(CSpec /home/sotty/Codes_Installed_by_CS/root/root-6.10.08-build/lib/libCore.so) #target_link_libraries(CSpec /home/sotty/Codes_Installed_by_CS/root/root-6.10.08-build/lib/libMathCore.so) #---------------------------------------------------------------------------- # Add the executable, and link it to the Geant4 libraries # add_executable(statusBar statusBar.cxx) target_link_libraries(statusBar ${ROOT_LIBRARIES}) #target_link_libraries(CSpec) #---------------------------------------------------------------------------- # Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX # #install(TARGETS CSpec DESTINATION bin)