Fixing coverty warnings for stream manipulators.
[u/mrichter/AliRoot.git] / CMakeLists.txt
CommitLineData
6db31708 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
e969a926 5
e969a926 6
6db31708 7cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
e969a926 8
6db31708 9#--------------------------------------------------------------------------------#
10# Set Basic CMake Configuration #
11#--------------------------------------------------------------------------------#
b07a2059 12
6db31708 13project(AliRoot CXX C Fortran)
bf4c2121 14
15# Environment variables
7f40fabf 16set(ALICE_ROOT $ENV{ALICE_ROOT})
6db31708 17set(ALICE $ENV{ALICE})
54e40a8e 18set(ALICE_INSTALL $ENV{ALICE_INSTALL})
1faae52c 19# Environment for SHUTTLE
20set(DIMDIR $ENV{DIMDIR})
21set(ODIR $ENV{ODIR})
6db31708 22
23if(NOT ALICE)
24 message(WARNING "Environment variable ALICE is not set")
25endif(NOT ALICE)
3ea0d710 26
3ea0d710 27if(NOT ALICE_ROOT)
6db31708 28 message(FATAL_ERROR "Please set ALICE_ROOT to the AliRoot source directory")
3ea0d710 29endif(NOT ALICE_ROOT)
30
6db31708 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)
24b052aa 38set(CMAKE_INSTALL_PREFIX ${ALICE_INSTALL})
6db31708 39
dad683d0 40get_filename_component(PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}" REALPATH)
f72dcc4f 41set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
0742852a 42set(CPACK_COMPONENTS_ALL MDC)
e969a926 43
6db31708 44include(ALICE_CMake)
f2cec6fb 45
6db31708 46#--------------------------------------------------------------------------------#
47# Find Packages #
48#--------------------------------------------------------------------------------#
e969a926 49
6db31708 50# Subversion
51# ------------------------------
e969a926 52
6db31708 53find_package(Subversion REQUIRED)
f7d3fd75 54
6db31708 55# ROOT
56# ------------------------------
f7d3fd75 57
6db31708 58find_package(ROOT REQUIRED)
3ea0d710 59
6db31708 60# IRST Rule Checker
61# ------------------------------
e969a926 62
6db31708 63find_package(RuleChecker)
e969a926 64
6db31708 65# DATE
66# ------------------------------
e969a926 67
6db31708 68find_package(DATE)
e969a926 69
6db31708 70# GEANT3
71# ------------------------------
e969a926 72
6db31708 73find_package(GEANT3)
e969a926 74
6db31708 75# AMORE
76# ------------------------------
77
78find_package(AMORE)
79
0742852a 80# AliRoot CPack configuration
81#-------------------------------
82
83find_package(CPack)
84
85
6db31708 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
0742852a 111
6db31708 112#--------------------------------------------------------------------------------#
113# AliRoot Modules #
114#--------------------------------------------------------------------------------#
115
116# Exclude Module from all target
117# ------------------------------
118
45526b5e 119#set(EXCLUDEMODULES THydjet SHUTTLE)
6db31708 120
0742852a 121
6db31708 122# Standard Modules
123# ------------------------------
39b1ae33 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 )
45526b5e 125
126if(THydjet)
127 list(APPEND ALIROOTMODULES THydjet)
128endif(THydjet)
129
130if(SHUTTLE)
131 list(APPEND ALIROOTMODULES SHUTTLE)
132endif(SHUTTLE)
6db31708 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)
811ffdcc 153elseif(NOT NOPYTHIA)
45526b5e 154 message(FATAL_ERROR "ROOT must have Pythia6 enabled !")
6db31708 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)
bf4c2121 171 if(EXISTS ${PROJECT_SOURCE_DIR}/.svn/ )
6db31708 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})
bf4c2121 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)
855ce9b3 184 string(REGEX MATCH "[^: ]+$" ALIROOT_SVN_REVISION ${f})
bf4c2121 185 endif(${f} MATCHES URL)
186 endforeach()
187 endif(EXISTS ${PROJECT_SOURCE_DIR}/.svn/ )
188
6db31708 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)
45526b5e 213add_custom_target(DA-all)
c2a2c0b8 214add_custom_target(check-all)
6a9e2760 215add_custom_target(par-all)
3a8dbb31 216add_custom_target(test-par-all)
7531a2ac 217
6db31708 218# Add Modules
219# ------------------------------
220foreach(MODULE ${MODDIRS})
45526b5e 221 set(${MODULE}ALIBS)
6db31708 222 configure_file(${PROJECT_SOURCE_DIR}/cmake/Module.tmp ${PROJECT_SOURCE_DIR}/${MODULE}/CMakeLists.txt @ONLY)
223 add_custom_target(${MODULE}-all ALL)
c2a2c0b8 224 add_custom_target(${MODULE}-check-all)
3a8dbb31 225 add_custom_target(${MODULE}-par-all)
226 add_custom_target(test-${MODULE}-par-all)
c2a2c0b8 227 add_dependencies(check-all "${MODULE}-check-all")
529f129e 228 add_custom_target(${MODULE}-all-static)
6db31708 229 add_dependencies(alilibs-static "${MODULE}-static")
230 add_subdirectory(${MODULE})
6db31708 231endforeach(MODULE)
232
c3b22277 233if(DATE_FOUND AND AMORE_FOUND)
234 include (CMakeDA)
235endif(DATE_FOUND AND AMORE_FOUND)
236
6db31708 237#--------------------------------------------------------------------------------#
238# Additional Targets #
239#--------------------------------------------------------------------------------#
240
7531a2ac 241# AliMdc RPM
242# ------------------------------
243
6db31708 244include (InstallRequiredSystemLibraries)
245include (CPack)
e969a926 246