CMakeLists.txt 1.8 KB
Newer Older
1 2 3
############################################################################
# CMakeLists.txt file for building TELoss package
############################################################################
4

5
# include_directories(TELoss)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

# Get the list of include directories
get_property(INCLUDE_DIRS DIRECTORY PROPERTY INCLUDE_DIRECTORIES)

# Print the include directories
message(STATUS "Include directories: ${INCLUDE_DIRS}")
message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")

# Add the source files specific to the TELoss module
set(SOURCES
    TELoss.cpp
    TELoss.h
    TELossLinkDef.h
)

# Add the Fortran source file
set(FORTRAN_SOURCES
    ELOSS.f90
)

# Generate dictionary for TELoss class
28 29 30 31 32
ROOT_GENERATE_DICTIONARY(
    G__TELoss
        ${CMAKE_CURRENT_SOURCE_DIR}/TELoss.h 
    LINKDEF 
        ${CMAKE_CURRENT_SOURCE_DIR}/TELossLinkDef.h)
33 34 35 36 37 38 39 40 41 42 43 44 45

# Add the dictionary source file to the sources list
list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/G__TELoss.cxx)

# Create a library target for the TELoss module
add_library(TELoss SHARED ${SOURCES} ${FORTRAN_SOURCES})

# Link against ROOT libraries
target_link_libraries(TELoss ${ROOT_LIBRARIES})

# Set compiler flags for Fortran source
enable_language(Fortran)
set_source_files_properties(${FORTRAN_SOURCES} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
46 47 48 49 50

# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/G__AculData.cxx DESTINATION ${CMAKE_BINARY_DIR}/include)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libTELoss.rootmap DESTINATION ${CMAKE_BINARY_DIR}/lib)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libTELoss_rdict.pcm DESTINATION ${CMAKE_BINARY_DIR}/lib)
install(TARGETS TELoss LIBRARY DESTINATION ${CMAKE_BINARY_DIR}/lib ARCHIVE DESTINATION ${CMAKE_BINARY_DIR}/lib)