OSDN Git Service

remove SQL component [ci reset]
[kde/Katie.git] / cmake / modules / OptimizeHeaders.cmake
1 # Copyright (C) 2015, Ivailo Monev, <xakepa10@gmail.com>
2 # Redistribution and use is allowed according to the terms of the BSD license.
3
4 # UNIFDEF_EXECUTABLE and HEADERS_DIRECTORY origin from the macro call
5
6 set(headers_directory "$ENV{DESTDIR}/${HEADERS_DIRECTORY}")
7 file(GLOB_RECURSE headers "${headers_directory}/*.h")
8
9 set(unifdef_arguments
10     # bootstrap
11     -UQT_BOOTSTRAPPED
12     -UQT_MOC
13     # not supported
14     -UQT_NO_QOBJECT
15     -UQT_NO_COMPRESS
16     -UQT_NO_THREAD
17     -UQT_NO_PROCESS
18     -UQT_NO_DATASTREAM
19     -UQT_NO_TEXTSTREAM
20     -UQT_NO_REGEXP
21     -UQT_NO_REGEXP_ANCHOR_ALT
22     -UQT_NO_REGEXP_BACKREF
23     -UQT_NO_REGEXP_CAPTURE
24     -UQT_NO_REGEXP_CCLASS
25     -UQT_NO_REGEXP_ESCAPE
26     -UQT_NO_REGEXP_INTERVAL
27     -UQT_NO_REGEXP_LOOKAHEAD
28     -UQT_NO_REGEXP_OPTIM
29     -UQT_NO_REGEXP_WILDCARD
30     -UQT_NO_STANDARDPATHS
31     -UQT_NO_SETTINGS
32     -UQT_NO_TEXTCODEC
33     # exports
34     -UKtCore_EXPORTS
35     -UKtGui_EXPORTS
36     -UKtNetwork_EXPORTS
37     -UKtSvg_EXPORTS
38     -UKtTest_EXPORTS
39     -UKtDeclarative_EXPORTS
40     -UKtXml_EXPORTS
41     -UKtScript_EXPORTS
42     -UKtScriptTools_EXPORTS
43     -UKtDBus_EXPORTS
44     -UKtUiTools_EXPORTS
45     -UKtDesigner_EXPORTS
46 )
47
48 message(STATUS "Optimizing header in: ${headers_directory}")
49 execute_process(
50     COMMAND ${UNIFDEF_EXECUTABLE} -m ${unifdef_arguments} ${headers}
51     RESULT_VARIABLE unifdef_result
52     ERROR_VARIABLE unifdef_output
53     OUTPUT_VARIABLE unifdef_output
54 )
55 # unifdef exits with status 1 if the output differes, see its man page
56 if(unifdef_result GREATER 1)
57     message(FATAL_ERROR "${unifdef_output} (${unifdef_result})")
58 endif()