Using quotes in the string operations
[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)
7f40fabf 14set(ALICE_ROOT $ENV{ALICE_ROOT})
6db31708 15set(ALICE $ENV{ALICE})
54e40a8e 16set(ALICE_INSTALL $ENV{ALICE_INSTALL})
6db31708 17
18if(NOT ALICE)
19 message(WARNING "Environment variable ALICE is not set")
20endif(NOT ALICE)
3ea0d710 21
3ea0d710 22if(NOT ALICE_ROOT)
6db31708 23 message(FATAL_ERROR "Please set ALICE_ROOT to the AliRoot source directory")
3ea0d710 24endif(NOT ALICE_ROOT)
25
6db31708 26# Set AliRoot Installation directory
27if(NOT ALICE_INSTALL)
28 message(STATUS "AliRoot files will be installed in ${ALICE_ROOT}. You can specify a different location by setting ALICE_INSTALL environment variable")
29 set(ALICE_INSTALL ${ALICE_ROOT})
30else()
31 message(STATUS "AliRoot files will be installed in ${ALICE_INSTALL}")
32endif(NOT ALICE_INSTALL)
24b052aa 33set(CMAKE_INSTALL_PREFIX ${ALICE_INSTALL})
6db31708 34
dad683d0 35get_filename_component(PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}" REALPATH)
f72dcc4f 36set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
0742852a 37set(CPACK_COMPONENTS_ALL MDC)
e969a926 38
6db31708 39include(ALICE_CMake)
f2cec6fb 40
6db31708 41#--------------------------------------------------------------------------------#
42# Find Packages #
43#--------------------------------------------------------------------------------#
e969a926 44
6db31708 45# Subversion
46# ------------------------------
e969a926 47
6db31708 48find_package(Subversion REQUIRED)
f7d3fd75 49
6db31708 50# ROOT
51# ------------------------------
f7d3fd75 52
6db31708 53find_package(ROOT REQUIRED)
3ea0d710 54
6db31708 55# IRST Rule Checker
56# ------------------------------
e969a926 57
6db31708 58find_package(RuleChecker)
e969a926 59
6db31708 60# DATE
61# ------------------------------
e969a926 62
6db31708 63find_package(DATE)
e969a926 64
6db31708 65# GEANT3
66# ------------------------------
e969a926 67
6db31708 68find_package(GEANT3)
e969a926 69
6db31708 70# AMORE
71# ------------------------------
72
73find_package(AMORE)
74
0742852a 75# AliRoot CPack configuration
76#-------------------------------
77
78find_package(CPack)
79
80
6db31708 81#--------------------------------------------------------------------------------#
82# Environment/Compiler Configuration #
83#--------------------------------------------------------------------------------#
84
85ALICE_CheckOutOfSourceBuild()
86ALICE_RootConfig(CMAKE_CXX_COMPILER --cxx)
87ALICE_RootConfig(CMAKE_C_COMPILER --cc)
88ALICE_RootConfig(CMAKE_Fortran_COMPILER --f77)
89ALICE_ConfigurePlatform()
90ALICE_ConfigureCompiler()
91
92
93#--------------------------------------------------------------------------------#
94# AliRoot Path Settings #
95#--------------------------------------------------------------------------------#
96
97ALICE_DevFlagsOutput()
98set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/tgt_${ALICE_TARGET}")
99set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET}")
100set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib/tgt_${ALICE_TARGET}")
101set(CMAKE_INCLUDE_EXPORT_DIRECTORY "${PROJECT_BINARY_DIR}/include")
102file(MAKE_DIRECTORY ${CMAKE_INCLUDE_EXPORT_DIRECTORY})
103set(EXPORTDIRS "${ALICE_INSTALL}/include")
104set(BINLIBDIRS "-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
105
0742852a 106
6db31708 107#--------------------------------------------------------------------------------#
108# AliRoot Modules #
109#--------------------------------------------------------------------------------#
110
111# Exclude Module from all target
112# ------------------------------
113
45526b5e 114#set(EXCLUDEMODULES THydjet SHUTTLE)
6db31708 115
0742852a 116
6db31708 117# Standard Modules
118# ------------------------------
d81eb3bf 119set(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 ESDCheck STAT TTherminator CORRFW DPMJET TDPMjet PWG0 PWG1 PWG2 PWG3 PWG4 TRIGGER PYTHIA8 TAmpt OADB )
45526b5e 120
121if(THydjet)
122 list(APPEND ALIROOTMODULES THydjet)
123endif(THydjet)
124
125if(SHUTTLE)
126 list(APPEND ALIROOTMODULES SHUTTLE)
127endif(SHUTTLE)
6db31708 128
129# Additional Modules
130# ------------------------------
131list(APPEND ALIROOTMODULES TUHKMgen EPOS)
132
133# EVE
134# ------------------------------
135ALICE_RootConfig(EVE --has-opengl)
136if(NOT EVE STREQUAL "no")
137 list(APPEND ALIROOTMODULES EVE)
138endif(NOT EVE STREQUAL "no")
139
140# CERN Modules
141# ------------------------------
142set(CERNMODULES LHAPDF HIJING MICROCERN HERWIG)
143
144# Check for Pythia 6
145if(EXISTS ${ROOTINCDIR}/TPythia6.h)
146 set(PYTHIA6 TRUE)
147 list(APPEND CERNMODULES PYTHIA6 RALICE EVGEN)
811ffdcc 148elseif(NOT NOPYTHIA)
45526b5e 149 message(FATAL_ERROR "ROOT must have Pythia6 enabled !")
6db31708 150endif(EXISTS ${ROOTINCDIR}/TPythia6.h)
151
152# Set Final list of modules
153set(MODULES ${ALIROOTMODULES} ${CERNMODULES} ALIROOT)
154
155# Set Module directories
156set(MODDIRS ${MODULES})
157
158# Libraries for Linking
159# ------------------------------
160set(ALILIBS MUON TPC PMD TRD FMD TOF ITS PHOS ACORDE HMPID VZERO ZDC STRUCT T0 EVGEN STEER TRIGGER)
161set(LIBS ${ROOTCLIBS} ${ROOTPLIBS} ${SYSLIBS})
162
163# Configure ARVerion.h
164# ------------------------------
165if(Subversion_FOUND)
166 Subversion_WC_INFO(${PROJECT_SOURCE_DIR} PROJECT)
167 set(ALIROOT_SVN_REVISION ${PROJECT_WC_REVISION})
168 set(ALIROOT_SVN_BRANCH ${PROJECT_WC_URL})
169 string(REGEX MATCH "[^/]+$" ALIROOT_SVN_BRANCH ${ALIROOT_SVN_BRANCH})
170 message(STATUS "Aliroot Revision - ${ALIROOT_SVN_REVISION} Branch - ${ALIROOT_SVN_BRANCH}")
171 if(EXISTS ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
172 file(REMOVE ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
173 endif(EXISTS ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h)
174 configure_file(${PROJECT_SOURCE_DIR}/cmake/ARVersion.h.tmp ${CMAKE_INCLUDE_EXPORT_DIRECTORY}/ARVersion.h @ONLY)
175endif(Subversion_FOUND)
176
177#--------------------------------------------------------------------------------#
178# Build Modules #
179#--------------------------------------------------------------------------------#
180
181# Module Variables
182# ------------------------------
183set(ALLLIBS)
184set(ALLEXECS)
185set(INCLUDEFILES)
186set(BINLIBS)
187set(EXPORTFILES)
188
189# Top Level Build Targets
190# ------------------------------
191
192add_custom_target(alilibs-static)
193add_custom_target(include-headers)
45526b5e 194add_custom_target(DA-all)
c2a2c0b8 195add_custom_target(check-all)
6a9e2760 196add_custom_target(par-all)
3a8dbb31 197add_custom_target(test-par-all)
7531a2ac 198
6db31708 199# Add Modules
200# ------------------------------
201foreach(MODULE ${MODDIRS})
45526b5e 202 set(${MODULE}ALIBS)
6db31708 203 configure_file(${PROJECT_SOURCE_DIR}/cmake/Module.tmp ${PROJECT_SOURCE_DIR}/${MODULE}/CMakeLists.txt @ONLY)
204 add_custom_target(${MODULE}-all ALL)
c2a2c0b8 205 add_custom_target(${MODULE}-check-all)
3a8dbb31 206 add_custom_target(${MODULE}-par-all)
207 add_custom_target(test-${MODULE}-par-all)
c2a2c0b8 208 add_dependencies(check-all "${MODULE}-check-all")
529f129e 209 add_custom_target(${MODULE}-all-static)
6db31708 210 add_dependencies(alilibs-static "${MODULE}-static")
211 add_subdirectory(${MODULE})
6db31708 212endforeach(MODULE)
213
c3b22277 214if(DATE_FOUND AND AMORE_FOUND)
215 include (CMakeDA)
216endif(DATE_FOUND AND AMORE_FOUND)
217
6db31708 218#--------------------------------------------------------------------------------#
219# Additional Targets #
220#--------------------------------------------------------------------------------#
221
7531a2ac 222# AliMdc RPM
223# ------------------------------
224
6db31708 225include (InstallRequiredSystemLibraries)
226include (CPack)
e969a926 227