]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/EMCALbase/CMakeLists.txt
Correct use of ROOT_INCLUDE_DIR
[u/mrichter/AliRoot.git] / EMCAL / EMCALbase / CMakeLists.txt
CommitLineData
2509791b 1# **************************************************************************
2# * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
3# * *
4# * Author: The ALICE Off-line Project. *
5# * Contributors are mentioned in the code where appropriate. *
6# * *
7# * Permission to use, copy, modify and distribute this software and its *
8# * documentation strictly for non-commercial purposes is hereby granted *
9# * without fee, provided that the above copyright notice appears in all *
10# * copies and that both the copyright notice and this permission notice *
11# * appear in the supporting documentation. The authors make no claims *
12# * about the suitability of this software for any purpose. It is *
13# * provided "as is" without express or implied warranty. *
14# **************************************************************************
15
16# Module
17set(MODULE EMCALbase)
18
19# Module include folder
427d561c 20include_directories(${AliRoot_SOURCE_DIR}/EMCAL/${MODULE})
2509791b 21
22# Additional include folders in alphabetical order except ROOT
f0315837 23include_directories(${ROOT_INCLUDE_DIR}
427d561c 24 ${AliRoot_SOURCE_DIR}/EMCAL/EMCALraw
427d561c 25 ${AliRoot_SOURCE_DIR}/EMCAL/EMCALUtils
26 ${AliRoot_SOURCE_DIR}/RAW/RAWDatabase
27 ${AliRoot_SOURCE_DIR}/RAW/RAWDatarec
df9719ef 28 ${AliRoot_SOURCE_DIR}/RAW/RAWDatasim
427d561c 29 ${AliRoot_SOURCE_DIR}/STEER/CDB
30 ${AliRoot_SOURCE_DIR}/STEER/ESD
31 ${AliRoot_SOURCE_DIR}/STEER/STEER
32 ${AliRoot_SOURCE_DIR}/STEER/STEERBase
2509791b 33 )
34
35# Sources in alphabetical order
36set(SRCS
37 AliCaloCalibPedestal.cxx
38 AliCaloCalibSignal.cxx
39 AliEMCALBiasAPD.cxx
40 AliEMCALCalibAbs.cxx
41 AliEMCALCalibData.cxx
42 AliEMCALCalibMapAPD.cxx
43 AliEMCALCalibReference.cxx
44 AliEMCALCalibTempCoeff.cxx
45 AliEMCALCalibTimeDep.cxx
46 AliEMCAL.cxx
47 AliEMCALDigit.cxx
48 AliEMCALDigitizer.cxx
49 AliEMCALHit.cxx
50 AliEMCALLoader.cxx
51 AliEMCALPreprocessor.cxx
52 AliEMCALQAChecker.cxx
53 AliEMCALRawDigit.cxx
df9719ef 54 AliEMCALRawUtils.cxx
2509791b 55 AliEMCALRecParam.cxx
56 AliEMCALRecPoint.cxx
57 AliEMCALSDigitizer.cxx
58 AliEMCALSensorTempArray.cxx
59 AliEMCALSensorTemp.cxx
60 AliEMCALSimParam.cxx
61 AliEMCALSpaceFrame.cxx
62 AliEMCALSurvey.cxx
2509791b 63 AliEMCALTriggerData.cxx
64 AliEMCALTriggerDCSConfig.cxx
65 AliEMCALTriggerDCSConfigDB.cxx
66 AliEMCALTriggerRawDigit.cxx
67 AliEMCALTriggerRawDigitMaker.cxx
68 AliEMCALTriggerSTUDCSConfig.cxx
69 AliEMCALTriggerSTURawStream.cxx
70 AliEMCALTriggerTRUDCSConfig.cxx
71 AliEMCALWsuCosmicRaySetUp.cxx
72 )
73
74# Headers from sources
75string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
76
7aa3ad25 77# Additional headers
78set(HDRS ${HDRS}
79 AliEMCALTriggerTypes.h
80)
81
2509791b 82# Generate the dictionary
83# It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
84get_directory_property(incdirs INCLUDE_DIRECTORIES)
85generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
86
139cbc46 87set(ROOT_DEPENDENCIES)
68aeb13b 88set(ALIROOT_DEPENDENCIES STEERBase STEER CDB ESD RAWDatabase RAWDatarec RAWDatasim EMCALraw EMCALUtils)
139cbc46 89
2509791b 90# Generate the ROOT map
91# Dependecies
139cbc46 92set(LIBDEPS ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
2509791b 93generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
94
7aa3ad25 95# Generate a PARfile target for this library
96add_target_parfile(${MODULE} "${SRCS}" "${HDRS}" "${MODULE}LinkDef.h" "${LIBDEPS}")
97
f82bfa66 98# Create an object to be reused in case of static libraries
99# Otherwise the sources will be compiled twice
139cbc46 100add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
101# Build dependencies for object, headers, defines etc
102add_dependencies(${MODULE}-object ${ALIROOT_DEPENDENCIES})
f82bfa66 103# Add a library to the project using the object
68aeb13b 104add_library(${MODULE} SHARED $<TARGET_OBJECTS:${MODULE}-object>)
2509791b 105
f82bfa66 106# dependencies
139cbc46 107target_link_libraries(${MODULE} ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
2509791b 108
68aeb13b 109# Setting the correct headers for the object as gathered from the dependencies
110target_include_directories(${MODULE}-object PUBLIC $<TARGET_PROPERTY:${MODULE},INCLUDE_DIRECTORIES>)
111set_target_properties(${MODULE}-object PROPERTIES COMPILE_DEFINITIONS $<TARGET_PROPERTY:${MODULE},COMPILE_DEFINITIONS>)
112
2509791b 113# Additional compilation flags
139cbc46 114set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS "")
2509791b 115
116# System dependent: Modify the way the library is build
117if(${CMAKE_SYSTEM} MATCHES Darwin)
118 set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
119endif(${CMAKE_SYSTEM} MATCHES Darwin)
120
121# Installation
122install(TARGETS ${MODULE}
123 ARCHIVE DESTINATION lib
124 LIBRARY DESTINATION lib)
125
f82bfa66 126install(FILES ${HDRS} DESTINATION include)
127
128# Static version if DA enabled
129if(ALIROOT_STATIC)
68aeb13b 130 add_library(${MODULE}-static STATIC $<TARGET_OBJECTS:${MODULE}-object>)
f82bfa66 131 set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE})
68aeb13b 132
133 # list of shared dependencies / the name of the variable containing the list of static ones
134 generate_static_dependencies("${ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES")
135 target_link_libraries(${MODULE}-static ${STATIC_ALIROOT_DEPENDENCIES} Root RootExtra)
136
137 # Public include folders that will be propagated to the dependecies
138 target_include_directories(${MODULE}-static PUBLIC ${incdirs})
139
f82bfa66 140 set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
141
142 # Installation
143 install(TARGETS ${MODULE}-static
144 ARCHIVE DESTINATION lib
145 LIBRARY DESTINATION lib)
146endif(ALIROOT_STATIC)