]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HMPID/HMPIDbase/CMakeLists.txt
Correct use of ROOT_INCLUDE_DIR
[u/mrichter/AliRoot.git] / HMPID / HMPIDbase / CMakeLists.txt
CommitLineData
58c271b6 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 HMPIDbase)
18
19# Module include folder
427d561c 20include_directories(${AliRoot_SOURCE_DIR}/HMPID/${MODULE})
58c271b6 21
22# Additional include folders in alphabetical order except ROOT
f0315837 23include_directories(${ROOT_INCLUDE_DIR}
427d561c 24 ${AliRoot_SOURCE_DIR}/RAW/RAWDatabase
25 ${AliRoot_SOURCE_DIR}/RAW/RAWDatarec
26 ${AliRoot_SOURCE_DIR}/RAW/RAWDatasim
27 ${AliRoot_SOURCE_DIR}/STEER/CDB
28 ${AliRoot_SOURCE_DIR}/STEER/ESD
29 ${AliRoot_SOURCE_DIR}/STEER/STEER
30 ${AliRoot_SOURCE_DIR}/STEER/STEERBase
58c271b6 31 )
32
33# Sources in alphabetical order
34set(SRCS
c34819dc 35 AliHMPID.cxx
58c271b6 36 AliHMPIDCalib.cxx
37 AliHMPIDCluster.cxx
38 AliHMPIDDigit.cxx
39 AliHMPIDHit.cxx
40 AliHMPIDMisAligner.cxx
41 AliHMPIDParam.cxx
42 AliHMPIDPreprocessor.cxx
43 AliHMPIDQAChecker.cxx
44 AliHMPIDRawStream.cxx
45 )
46
47# Headers from sources
48string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
49
50# Generate the dictionary
51# It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
52get_directory_property(incdirs INCLUDE_DIRECTORIES)
53generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
54
46e377fb 55# Setting the dependencies
56set(ROOT_DEPENDENCIES TreePlayer)
57set(ALIROOT_DEPENDENCIES STEERBase STEER CDB ESD RAWDatabase RAWDatarec RAWDatasim)
58
58c271b6 59# Generate the ROOT map
60# Dependecies
46e377fb 61set(LIBDEPS ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
58c271b6 62generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
63
46e377fb 64# Create an object to be reused in case of static libraries
65# Otherwise the sources will be compiled twice
66add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
139cbc46 67# Follow headers dependencies
68add_dependencies(${MODULE}-object ${ALIROOT_DEPENDENCIES})
46e377fb 69# Add a library to the project using the object
68aeb13b 70add_library(${MODULE} SHARED $<TARGET_OBJECTS:${MODULE}-object>)
71
46e377fb 72target_link_libraries(${MODULE} ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
58c271b6 73
68aeb13b 74# Setting the correct headers for the object as gathered from the dependencies
75target_include_directories(${MODULE}-object PUBLIC $<TARGET_PROPERTY:${MODULE},INCLUDE_DIRECTORIES>)
76set_target_properties(${MODULE}-object PROPERTIES COMPILE_DEFINITIONS $<TARGET_PROPERTY:${MODULE},COMPILE_DEFINITIONS>)
77
58c271b6 78# Additional compilation flags
68aeb13b 79set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS " ")
58c271b6 80
81# System dependent: Modify the way the library is build
82if(${CMAKE_SYSTEM} MATCHES Darwin)
83 set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
84endif(${CMAKE_SYSTEM} MATCHES Darwin)
85
86# Installation
87install(TARGETS ${MODULE}
88 ARCHIVE DESTINATION lib
89 LIBRARY DESTINATION lib)
90
46e377fb 91install(FILES ${HDRS} DESTINATION include)
92
93# Static version if DA enabled
94if(ALIROOT_STATIC)
68aeb13b 95 add_library(${MODULE}-static STATIC $<TARGET_OBJECTS:${MODULE}-object>)
46e377fb 96 set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE})
97
98 # list of shared dependencies / the name of the variable containing the list of static ones
99 generate_static_dependencies("${ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES")
100 target_link_libraries(${MODULE}-static ${STATIC_ALIROOT_DEPENDENCIES} Root)
68aeb13b 101
102 # Public include folders that will be propagated to the dependecies
103 target_include_directories(${MODULE}-static PUBLIC ${incdirs})
104
46e377fb 105 set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
106
107 # Installation
108 install(TARGETS ${MODULE}-static
109 ARCHIVE DESTINATION lib
110 LIBRARY DESTINATION lib)
111endif(ALIROOT_STATIC)