Fixing coverty warnings for stream manipulators.
[u/mrichter/AliRoot.git] / CMakeLists.txt
... / ...
CommitLineData
1# Top level CMakeList.txt file for the AliRoot Build System
2#
3# Author: Johny Jose (johny.jose@cern.ch)
4# Port of previous Makefile build to cmake
5
6
7cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
8
9#--------------------------------------------------------------------------------#
10# Set Basic CMake Configuration #
11#--------------------------------------------------------------------------------#
12
13project(AliRoot CXX C Fortran)
14
15# Environment variables
16set(ALICE_ROOT $ENV{ALICE_ROOT})
17set(ALICE $ENV{ALICE})
18set(ALICE_INSTALL $ENV{ALICE_INSTALL})
19# Environment for SHUTTLE
20set(DIMDIR $ENV{DIMDIR})
21set(ODIR $ENV{ODIR})
22
23if(NOT ALICE)
24 message(WARNING "Environment variable ALICE is not set")
25endif(NOT ALICE)
26
27if(NOT ALICE_ROOT)
28 message(FATAL_ERROR "Please set ALICE_ROOT to the AliRoot source directory")
29endif(NOT ALICE_ROOT)
30
31# Set AliRoot Installation directory
32if(NOT ALICE_INSTALL)
33 message(STATUS "AliRoot files will be installed in ${ALICE_ROOT}. You can specify a different location by setting ALICE_INSTALL environment variable")
34 set(ALICE_INSTALL ${ALICE_ROOT})
35else()
36 message(STATUS "AliRoot files will be installed in ${ALICE_INSTALL}")
37endif(NOT ALICE_INSTALL)
38set(CMAKE_INSTALL_PREFIX ${ALICE_INSTALL})
39
40get_filename_component(PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}" REALPATH)
41set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
42set(CPACK_COMPONENTS_ALL MDC)
43
44include(ALICE_CMake)
45
46#--------------------------------------------------------------------------------#
47# Find Packages #
48#--------------------------------------------------------------------------------#
49
50# Subversion
51# ------------------------------
52
53find_package(Subversion REQUIRED)
54
55# ROOT
56# ------------------------------
57
58find_package(ROOT REQUIRED)
59
60# IRST Rule Checker
61# ------------------------------
62
63find_package(RuleChecker)
64
65# DATE
66# ------------------------------
67
68find_package(DATE)
69
70# GEANT3
71# ------------------------------
72
73find_package(GEANT3)
74
75# AMORE
76# ------------------------------
77
78find_package(AMORE)
79
80# AliRoot CPack configuration
81#-------------------------------
82
83find_package(CPack)
84
85
86#--------------------------------------------------------------------------------#
87# Environment/Compiler Configuration #
88#--------------------------------------------------------------------------------#
89
90ALICE_CheckOutOfSourceBuild()
91ALICE_RootConfig(CMAKE_CXX_COMPILER --cxx)
92ALICE_RootConfig(CMAKE_C_COMPILER --cc)
93ALICE_RootConfig(CMAKE_Fortran_COMPILER --f77)
94ALICE_ConfigurePlatform()
95ALICE_ConfigureCompiler()
96
97
98#--------------------------------------------------------------------------------#
99# AliRoot Path Settings #
100#--------------------------------------------------------------------------------#
101
102ALICE_DevFlagsOutput()
103set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/tgt_${ALICE_TARGET}")
104set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET}")
105set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET}")
106set(CMAKE_INCLUDE_EXPORT_DIRECTORY "${PROJECT_BINARY_DIR}/include")
107file(MAKE_DIRECTORY ${CMAKE_INCLUDE_EXPORT_DIRECTORY})
108set(EXPORTDIRS "${ALICE_INSTALL}/include")
109set(BINLIBDIRS "-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
110
111
112#--------------------------------------------------------------------------------#
113# AliRoot Modules #
114#--------------------------------------------------------------------------------#
115
116# Exclude Module from all target
117# ------------------------------
118
119#set(EXCLUDEMODULES THydjet SHUTTLE)
120
121
122# Standard Modules
123# ------------------------------
124set(ALIROOTMODULES STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS ACORDE HMPID T0 BCM STRUCT VZERO THijing THbtp EMCAL THerwig TEPEMGEN FASTSIM TPHIC RAW MONITOR ANALYSIS JETAN HLT LHC STAT TTherminator CORRFW DPMJET TDPMjet PWG0 PWG1 PWG2 PWG3 PWG4 TRIGGER PYTHIA8 TAmpt OADB )
125
126if(THydjet)
127 list(APPEND ALIROOTMODULES THydjet)
128endif(THydjet)
129
130if(SHUTTLE)
131 list(APPEND ALIROOTMODULES SHUTTLE)
132endif(SHUTTLE)
133
134# Additional Modules
135# ------------------------------
136list(APPEND ALIROOTMODULES TUHKMgen EPOS)
137
138# EVE
139# ------------------------------
140ALICE_RootConfig(EVE --has-opengl)
141if(NOT EVE STREQUAL "no")
142 list(APPEND ALIROOTMODULES EVE)
143endif(NOT EVE STREQUAL "no")
144
145# CERN Modules
146# ------------------------------
147set(CERNMODULES LHAPDF HIJING MICROCERN HERWIG)
148
149# Check for Pythia 6
150if(EXISTS ${ROOTINCDIR}/TPythia6.h)
151 set(PYTHIA6 TRUE)
152 list(APPEND CERNMODULES PYTHIA6 RALICE EVGEN)
153elseif(NOT NOPYTHIA)
154 message(FATAL_ERROR "ROOT must have Pythia6 enabled !")
155endif(EXISTS ${ROOTINCDIR}/TPythia6.h)
156
157# Set Final list of modules
158set(MODULES ${ALIROOTMODULES} ${CERNMODULES} ALIROOT)
159
160# Set Module directories
161set(MODDIRS ${MODULES})
162
163# Libraries for Linking
164# ------------------------------
165set(ALILIBS MUON TPC PMD TRD FMD TOF ITS PHOS ACORDE HMPID VZERO ZDC STRUCT T0 EVGEN STEER TRIGGER)
166set(LIBS ${ROOTCLIBS} ${ROOTPLIBS} ${SYSLIBS})
167
168# Configure ARVerion.h
169# ------------------------------
170if(Subversion_FOUND)
171 if(EXISTS ${PROJECT_SOURCE_DIR}/.svn/ )
172 Subversion_WC_INFO(${PROJECT_SOURCE_DIR} PROJECT)
173 set(ALIROOT_SVN_REVISION ${PROJECT_WC_REVISION})
174 set(ALIROOT_SVN_BRANCH ${PROJECT_WC_URL})
175 string(REGEX MATCH "[^/]+$" ALIROOT_SVN_BRANCH ${ALIROOT_SVN_BRANCH})
176
177 elseif(EXISTS ${PROJECT_SOURCE_DIR}/.git/ )
178 execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND git svn info OUTPUT_VARIABLE OUTPUTVAR)
179 string(REPLACE "\n" ";" OUTPUTVAR ${OUTPUTVAR})
180 foreach(f ${OUTPUTVAR})
181 if(${f} MATCHES URL)
182 string(REGEX MATCH "[^/]+$" ALIROOT_SVN_BRANCH ${f})
183 elseif(${f} MATCHES Revision)
184 string(REGEX MATCH "[^: ]+$" ALIROOT_SVN_REVISION ${f})
185 endif(${f} MATCHES URL)
186 endforeach()
187 endif(EXISTS ${PROJECT_SOURCE_DIR}/.svn/ )
188
189 message(STATUS "Aliroot Revision - ${ALIROOT_SVN_REVISION} Branch - ${ALIROOT_SVN_BRANCH}")
190 if(EXISTS ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
191 file(REMOVE ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
192 endif(EXISTS ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
193 configure_file(${PROJECT_SOURCE_DIR}/cmake/ARVersion.h.tmp ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h @ONLY)
194endif(Subversion_FOUND)
195
196#--------------------------------------------------------------------------------#
197# Build Modules #
198#--------------------------------------------------------------------------------#
199
200# Module Variables
201# ------------------------------
202set(ALLLIBS)
203set(ALLEXECS)
204set(INCLUDEFILES)
205set(BINLIBS)
206set(EXPORTFILES)
207
208# Top Level Build Targets
209# ------------------------------
210
211add_custom_target(alilibs-static)
212add_custom_target(include-headers)
213add_custom_target(DA-all)
214add_custom_target(check-all)
215add_custom_target(par-all)
216add_custom_target(test-par-all)
217
218# Add Modules
219# ------------------------------
220foreach(MODULE ${MODDIRS})
221 set(${MODULE}ALIBS)
222 configure_file(${PROJECT_SOURCE_DIR}/cmake/Module.tmp ${PROJECT_SOURCE_DIR}/${MODULE}/CMakeLists.txt @ONLY)
223 add_custom_target(${MODULE}-all ALL)
224 add_custom_target(${MODULE}-check-all)
225 add_custom_target(${MODULE}-par-all)
226 add_custom_target(test-${MODULE}-par-all)
227 add_dependencies(check-all "${MODULE}-check-all")
228 add_custom_target(${MODULE}-all-static)
229 add_dependencies(alilibs-static "${MODULE}-static")
230 add_subdirectory(${MODULE})
231endforeach(MODULE)
232
233if(DATE_FOUND AND AMORE_FOUND)
234 include (CMakeDA)
235endif(DATE_FOUND AND AMORE_FOUND)
236
237#--------------------------------------------------------------------------------#
238# Additional Targets #
239#--------------------------------------------------------------------------------#
240
241# AliMdc RPM
242# ------------------------------
243
244include (InstallRequiredSystemLibraries)
245include (CPack)
246