CMakeLists.txt 1.4 KB
Newer Older
1 2 3
############################################################################
# CMakeLists.txt file for building TELoss package
############################################################################
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

include_directories(TELoss)

# 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)