Merged modifications from Francesco Prino (corrections to ITS points, K- and secondar...
[u/mrichter/AliRoot.git] / CMakeLists.txt
CommitLineData
e969a926 1# -*- mode: cmake -*-
e969a926 2
3# Check if cmake has the required version
7f40fabf 4cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
e969a926 5
6# Set name of our project to AliRoot. To be done after check of cmake version
7f40fabf 7project(AliRoot NONE)
e969a926 8
9# Set AliRoot variables
7f40fabf 10set(ALICE_ROOT $ENV{ALICE_ROOT})
11set(ALICE $ENV{ALICE})
12set(ALICE_STATIC_BUILD OFF CACHE BOOL "Build also statics libs")
e969a926 13
7f40fabf 14message("ALICE_ROOT: ${ALICE_ROOT}")
15set(CMAKE_VERBOSE_MAKEFILE ON)
e969a926 16
17# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
7f40fabf 18set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
19set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
20set(CMAKE_MODULE_PATH "${ALICE_ROOT}/cmake/modules")
e969a926 21
f7d3fd75 22# To fix a hack that has been introduced for the Mac
7f40fabf 23if(APPLE)
24 set(CMAKE_INSTALL_NAME_TOOL CMAKE_INSTALL_NAME_TOOL-NOTFOUND)
25endif(APPLE)
f7d3fd75 26
f7d3fd75 27# Setup ROOT
7f40fabf 28find_package(ROOT 5.0.0 REQUIRED)
f7d3fd75 29
7f40fabf 30set(CMAKE_C_COMPILER $ENV{CC})
31enable_language(C)
f7d3fd75 32
7f40fabf 33set(CMAKE_CXX_COMPILER $ENV{CXX})
34enable_language(CXX)
f7d3fd75 35
7f40fabf 36set(CMAKE_Fortran_COMPILER $ENV{F77})
37enable_language(Fortran)
f7d3fd75 38
e969a926 39# Load some basic macros which are needed later on
40#Include(WriteConfigFile)
7f40fabf 41include(Dart)
42include(ALICEMacros)
e969a926 43
44# Check if the user wants to build the project in the source directory
45Check_out_of_Source_Build()
46
47# searches for needed packages
48
7f40fabf 49Set(ALIROOT_INSTALL_DIR ${ALICE_INSTALL}/${ALICE_TARGET})
e969a926 50
51# Setup GEANT3
7f40fabf 52find_package(GEANT3 REQUIRED)
e969a926 53
54# Setup RuleChecker
7f40fabf 55find_package(RuleChecker)
e969a926 56
57# Check if DATE is installed
7f40fabf 58find_package(DATE)
e969a926 59
60# Setup system dependent flags
61SetupSystem()
62
7f40fabf 63Include(CreateSubCMakeFiles)
64CreateSubCMakeFiles()
96c0c856 65
96c0c856 66
e969a926 67# Set the library version in the main CMakeLists.txt
7f40fabf 68
69set(ALIROOT_MAJOR_VERSION 0)
70set(ALIROOT_MINOR_VERSION 0)
71set(ALIROOT_PATCH_VERSION 0)
72set(ALIROOT_VERSION "${ALIROOT_MAJOR_VERSION}.${ALIROOT_MINOR_VERSION}.${ALIROOT_PATCH_VERSION}")
73
74set(ALIROOT_LIBRARY_PROPERTIES ${ALIROOT_LIBRARY_PROPERTIES}
e969a926 75 VERSION "${ALIROOT_VERSION}"
76 SOVERSION "${ALIROOT_MAJOR_VERSION}"
77 SUFFIX ".so"
78)
79
80# Set version variables
7f40fabf 81find_program( READLINK_PROGRAM readlink)
6455495f 82
7f40fabf 83if(READLINK_PROGRAM)
84 execute_process(COMMAND readlink -f ${ALICE_ROOT}
6455495f 85 COMMAND xargs svn info
86 OUTPUT_VARIABLE _svn_out)
7f40fabf 87else(READLINK_PROGRAM)
88 execute_process(COMMAND svn info ${ALICE_ROOT}
6455495f 89 OUTPUT_VARIABLE _svn_out)
7f40fabf 90endif(READLINK_PROGRAM)
e969a926 91
7f40fabf 92string(REGEX REPLACE "^.*Revision: ([^\n]*).*$" "\\1"
e969a926 93 ALIROOT_SVN_REVISION ${_svn_out})
7f40fabf 94string(REGEX REPLACE "^.*URL: ([^\n]*).*$" "\\1"
e969a926 95 ALIROOT_SVN_BRANCH ${_svn_out})
7f40fabf 96string(REGEX REPLACE "^.*AliRoot/([^\n]*)" "\\1" ALIROOT_SVN_BRANCH ${ALIROOT_SVN_BRANCH})
97
e969a926 98
99# Additional targets
7f40fabf 100add_custom_target(check-all COMMENT "Checking coding conventions")
101message(STATUS "REVISION: ${ALIROOT_SVN_REVISION}")
102message(STATUS "BRANCH: ${ALIROOT_SVN_BRANCH}")
103
104# Delete and recreate header ARVersion Header file
105execute_process(COMMAND cmake -E remove "${CMAKE_CURRENT_BINARY_DIR}/STEER/ARVersion.h")
106configure_file(${CMAKE_CURRENT_SOURCE_DIR}/STEER/ARVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/STEER/ARVersion.h @ONLY)
107
108# Get list of enabled root features
109execute_process(COMMAND root-config --features OUTPUT_VARIABLE FEATURES)
110string(REGEX MATCH "pythia6" PYTHIA6 ${FEATURES})
111string(REGEX MATCH "pythia8" PYTHIA8 ${FEATURES})
112if(PYTHIA6)
113 message(STATUS "Pythia6 enabled")
114endif(PYTHIA6)
115if(PYTHIA8)
116 message(STATUS "Pythia8 enabled")
117endif(PYTHIA8)
e969a926 118
119# Recurse into the given subdirectories. This does not actually
120# cause another cmake executable to run. The same process will walk through
121# the project's entire directory structure.
122
7f40fabf 123
e969a926 124#Add_subdirectory(TFluka)
125#Add_subdirectory(THydjet)
126
127Add_subdirectory(ACORDE)
128Add_subdirectory(ANALYSIS)
129Add_subdirectory(BCM)
130Add_subdirectory(CORRFW)
131Add_subdirectory(DPMJET)
132Add_subdirectory(EMCAL)
fe9fbf07 133Add_subdirectory(EPOS)
e969a926 134Add_subdirectory(ESDCheck)
135Add_subdirectory(EVE)
136Add_subdirectory(EVGEN)
137Add_subdirectory(FASTSIM)
138Add_subdirectory(FMD)
e969a926 139Add_subdirectory(HERWIG)
140Add_subdirectory(HIJING)
141Add_subdirectory(HLT)
142Add_subdirectory(HMPID)
143Add_subdirectory(ITS)
144Add_subdirectory(JETAN)
145Add_subdirectory(LHAPDF)
146Add_subdirectory(LHC)
147Add_subdirectory(MICROCERN)
148Add_subdirectory(MONITOR)
149Add_subdirectory(MUON)
150Add_subdirectory(PHOS)
151Add_subdirectory(PMD)
152Add_subdirectory(PWG0)
153Add_subdirectory(PWG1)
154Add_subdirectory(PWG2)
155Add_subdirectory(PWG3)
156Add_subdirectory(PWG4)
7f40fabf 157if(PYTHIA6)
e969a926 158Add_subdirectory(PYTHIA6)
159Add_subdirectory(RALICE)
7f40fabf 160Add_subdirectory(TPHIC)
161endif(PYTHIA6)
162if(PYTHIA8)
163Add_subdirectory(PYTHIA8)
164endif(PYTHIA8)
e969a926 165Add_subdirectory(RAW)
166Add_subdirectory(STAT)
167Add_subdirectory(STEER)
168Add_subdirectory(STRUCT)
169Add_subdirectory(T0)
170Add_subdirectory(TDPMjet)
171Add_subdirectory(TEPEMGEN)
172Add_subdirectory(THbtp)
173Add_subdirectory(THerwig)
174Add_subdirectory(THijing)
ddd9c299 175#Add_subdirectory(TIsajet)
e969a926 176Add_subdirectory(TOF)
177Add_subdirectory(TPC)
e969a926 178Add_subdirectory(TRD)
96c0c856 179Add_subdirectory(TRIGGER)
e969a926 180Add_subdirectory(TTherminator)
fe9fbf07 181Add_subdirectory(TUHKMgen)
e969a926 182Add_subdirectory(VZERO)
183Add_subdirectory(ZDC)
e969a926 184Add_subdirectory(ALIROOT)
185