|
| 1 | +cmake_minimum_required(VERSION 3.0 FATAL_ERROR) |
| 2 | +project(GeneratorSlowNucleons) |
| 3 | + |
| 4 | +# You need to tell CMake where to find the ROOT installation. This can be done in a number of ways: |
| 5 | +# - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake |
| 6 | +# - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT |
| 7 | +list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS}) |
| 8 | + |
| 9 | +#---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS) |
| 10 | +find_package(ROOT REQUIRED COMPONENTS EG) |
| 11 | + |
| 12 | +#---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY) |
| 13 | +include(${ROOT_USE_FILE}) |
| 14 | + |
| 15 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.) |
| 16 | + |
| 17 | +set(HEADERS GeneratorSlowNucleons.h SlowNucleonModel.h SlowNucleonModelExp.h) |
| 18 | + |
| 19 | +ROOT_GENERATE_DICTIONARY(G__GeneratorSlowNucleons ${HEADERS} LINKDEF GeneratorSlowNucleonsLinkDef.h) |
| 20 | + |
| 21 | +#---Create a shared library with geneated dictionary |
| 22 | +add_library(GeneratorSlowNucleons SHARED GeneratorSlowNucleons.cxx SlowNucleonModel.cxx SlowNucleonModelExp.cxx G__GeneratorSlowNucleons.cxx) |
| 23 | +target_link_libraries(GeneratorSlowNucleons ${ROOT_LIBRARIES}) |
| 24 | + |
| 25 | + |
| 26 | +set_target_properties(GeneratorSlowNucleons |
| 27 | + PROPERTIES |
| 28 | + PUBLIC_HEADER "${HEADERS}" ) |
| 29 | + |
| 30 | + |
| 31 | +install(TARGETS GeneratorSlowNucleons |
| 32 | + LIBRARY DESTINATION lib |
| 33 | + PUBLIC_HEADER DESTINATION include) |
| 34 | + |
| 35 | +if (${ROOT_VERSION} VERSION_GREATER "6.0") |
| 36 | + install( |
| 37 | + FILES |
| 38 | + ${CMAKE_CURRENT_BINARY_DIR}/libGeneratorSlowNucleons_rdict.pcm |
| 39 | + ${CMAKE_CURRENT_BINARY_DIR}/libGeneratorSlowNucleons.rootmap |
| 40 | + DESTINATION lib) |
| 41 | +endif (${ROOT_VERSION} VERSION_GREATER "6.0") |
| 42 | + |
| 43 | +if(${CMAKE_SYSTEM} MATCHES Darwin) |
| 44 | + set_target_properties(GeneratorSlowNucleons PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") |
| 45 | +endif(${CMAKE_SYSTEM} MATCHES Darwin) |
0 commit comments