-
Notifications
You must be signed in to change notification settings - Fork 514
Expand file tree
/
Copy pathRunRootcling.cmake
More file actions
57 lines (48 loc) · 1.98 KB
/
Copy pathRunRootcling.cmake
File metadata and controls
57 lines (48 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.
#
# This software is distributed under the terms of the GNU General Public
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
#
# In applying this license CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.
# Runs rootcling, optionally appends PATCH to the generated dictionary, and
# turns the "Unused class rule" warning into an error.
#
# rootcling only offers -failOnWarnings, which is all or nothing, so the
# output still has to be inspected to single out that one warning.
#
# ARGS is separated by | rather than ; so that it survives as a single
# argument through add_custom_command.
if(NOT ROOTCLING OR NOT ARGS OR NOT DICTIONARY)
message(FATAL_ERROR "ROOTCLING, ARGS and DICTIONARY must all be given")
endif()
# Applied to rootcling only: it replaces rather than extends the inherited
# value, and cmake itself needs libraries it does not list.
if(LD_LIBRARY_PATH)
set(rootclingCmd ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ${ROOTCLING})
else()
set(rootclingCmd ${ROOTCLING})
endif()
string(REPLACE "|" ";" rootclingArgs "${ARGS}")
execute_process(COMMAND ${rootclingCmd} ${rootclingArgs}
OUTPUT_VARIABLE output
ERROR_VARIABLE output
RESULT_VARIABLE status)
if(output)
message("${output}")
endif()
if(NOT status EQUAL 0)
file(REMOVE ${DICTIONARY})
message(FATAL_ERROR "rootcling failed for ${DICTIONARY} with error code ${status}")
endif()
if(output MATCHES "Warning: Unused class rule")
file(REMOVE ${DICTIONARY})
message(FATAL_ERROR "please fix the warnings above about unused class rule")
endif()
if(PATCH)
file(READ ${PATCH} patchContent)
file(APPEND ${DICTIONARY} "${patchContent}")
endif()