#---------------------------------------------------------------------------- # Setup the project cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR) project(XurichLibs) #---------------------------------------------------------------------------- #Set the necessary path variables and find the ROOT package set(CMAKE_INSTALL_PREFIX $ENV{HOME}/lib) #set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib) set(CMAKE_MODULE_PATH $ENV{ROOTSYS}/etc/cmake) find_package(ROOT REQUIRED) set(all_root_libs ${ROOT_LIBRARIES}) #foreach(lib ${ROOT_LIBRARIES}) # message(STATUS "Using root library: " ${lib}) #endforeach(lib) set(CMAKE_MODULE_PATH $ENV{ROOTSYS}/cmake/module) find_package(ROOT REQUIRED) #foreach(lib ${ROOT_LIBRARIES}) # message(STATUS "Using root library: " ${lib}) #endforeach(lib) include(RootNewMacros) include_directories(${ROOT_INCLUDE_DIRS}) include_directories(${PROJECT_BINARY_DIR}/include) #---------------------------------------------------------------------------- #Copy all the source directories here file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src DESTINATION ./) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/include DESTINATION ./) #---------------------------------------------------------------------------- #Find all the sourcefiles in src directory file(GLOB _sources ${PROJECT_BINARY_DIR}/src/*.cc) file(GLOB _sources_shr ${PROJECT_BINARY_DIR}/src/shared/*.cc) #---------------------------------------------------------------------------- # Make the output directories file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/lib/shared) #---------------------------------------------------------------------------- # 1- Create the ROOT dictionaries with the standard ROOT function provided in their "RootNewMacros" module # 2- Create shared library in the xurich subdirectory (specific for xurich analysis) file(GLOB _headerlist ${PROJECT_BINARY_DIR}/include/*.hh) #foreach(header ${_headerlist}) #message(STATUS "Header name: " ${header}) #endforeach(header) #message(STATUS "_headerlist: " "${_headerlist}") root_generate_dictionary(XuAnalysisDict ${_headerlist} LINKDEF ${PROJECT_BINARY_DIR}/include/linkdef.h) #ROOT_LINKER_LIBRARY(XuAnalysis ${_sources} XuAnalysisDict.cxx LIBRARIES ${all_root_libs}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/xurich) add_library(XuAnalysis SHARED ${_sources} XuAnalysisDict.cxx) set_target_properties(XuAnalysis PROPERTIES SUFFIX .so) set_target_properties(XuAnalysis PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/xurich) target_link_libraries(XuAnalysis ${all_root_libs}) # Create shared library in the shared subdirectory (general analysis classes) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}) file(GLOB _headerlist_shr ${PROJECT_BINARY_DIR}/include/shared/*.hh) root_generate_dictionary(XuAnalysisShrDict ${_headerlist_shr} LINKDEF ${PROJECT_BINARY_DIR}/include/shared/linkdef.h) set(shrlibs) foreach(filename ${_sources_shr}) get_filename_component(filename ${filename} NAME) #message(STATUS ${filename}) string(REGEX REPLACE ".cc\$" "" libpostname ${filename}) set(libname ${libpostname}) add_library(${libname} SHARED ${_sources_shr} XuAnalysisShrDict.cxx) set_target_properties(${libname} PROPERTIES SUFFIX .so) #set_target_properties(${libname} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/shared) target_link_libraries(${libname} ${all_root_libs}) set(shrlibs ${shrlibs} "${libname}") endforeach(filename) #file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hh DESTINATION ${HOME}/include/) #file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/include/shared/*.hh DESTINATION ${HOME}/include/)