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