|
35 | 35 |
|
36 | 36 | include(MacroAddFileDependencies) |
37 | 37 |
|
38 | | -MACRO (QT4_GET_MOC_FLAGS _moc_flags) |
39 | | - SET(${_moc_flags}) |
40 | | - GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES) |
41 | | - |
42 | | - FOREACH(_current ${_inc_DIRS}) |
43 | | - IF("${_current}" MATCHES "\\.framework/?$") |
44 | | - STRING(REGEX REPLACE "/[^/]+\\.framework" "" framework_path "${_current}") |
45 | | - SET(${_moc_flags} ${${_moc_flags}} "-F${framework_path}") |
46 | | - ELSE("${_current}" MATCHES "\\.framework/?$") |
47 | | - SET(${_moc_flags} ${${_moc_flags}} "-I${_current}") |
48 | | - ENDIF("${_current}" MATCHES "\\.framework/?$") |
49 | | - ENDFOREACH(_current ${_inc_DIRS}) |
50 | | - |
51 | | - GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS) |
52 | | - FOREACH(_current ${_defines}) |
53 | | - SET(${_moc_flags} ${${_moc_flags}} "-D${_current}") |
54 | | - ENDFOREACH(_current ${_defines}) |
55 | | - |
56 | | - IF(Q_OS_WIN) |
57 | | - SET(${_moc_flags} ${${_moc_flags}} -DWIN32) |
58 | | - ENDIF(Q_OS_WIN) |
59 | | - |
60 | | -ENDMACRO(QT4_GET_MOC_FLAGS) |
61 | | - |
62 | | -# helper macro to set up a moc rule |
63 | | -MACRO (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options) |
64 | | - # For Windows, create a parameters file to work around command line length limit |
65 | | - IF (WIN32) |
66 | | - # Pass the parameters in a file. Set the working directory to |
67 | | - # be that containing the parameters file and reference it by |
68 | | - # just the file name. This is necessary because the moc tool on |
69 | | - # MinGW builds does not seem to handle spaces in the path to the |
70 | | - # file given with the @ syntax. |
71 | | - GET_FILENAME_COMPONENT(_moc_outfile_name "${outfile}" NAME) |
72 | | - GET_FILENAME_COMPONENT(_moc_outfile_dir "${outfile}" PATH) |
73 | | - IF(_moc_outfile_dir) |
74 | | - SET(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir}) |
75 | | - ENDIF(_moc_outfile_dir) |
76 | | - SET (_moc_parameters_file ${outfile}_parameters) |
77 | | - SET (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}") |
78 | | - STRING (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}") |
79 | | - FILE (WRITE ${_moc_parameters_file} "${_moc_parameters}") |
80 | | - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} |
81 | | - COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters |
82 | | - DEPENDS ${infile} |
83 | | - ${_moc_working_dir} |
84 | | - VERBATIM) |
85 | | - ELSE (WIN32) |
86 | | - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} |
87 | | - COMMAND ${QT_MOC_EXECUTABLE} |
88 | | - ARGS ${moc_flags} ${moc_options} -o ${outfile} ${infile} |
89 | | - DEPENDS ${infile} VERBATIM) |
90 | | - ENDIF (WIN32) |
91 | | -ENDMACRO (QT4_CREATE_MOC_COMMAND) |
92 | | - |
93 | | - |
94 | | -MACRO(QT4_AUTOMOC) |
95 | | - QT4_GET_MOC_FLAGS(_moc_INCS) |
96 | | - |
97 | | - SET(_matching_FILES ) |
98 | | - FOREACH (_current_FILE ${ARGN}) |
99 | | - |
100 | | - GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE) |
101 | | - # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. |
102 | | - # This is required to make uic work correctly: |
103 | | - # we need to add generated .cpp files to the sources (to compile them), |
104 | | - # but we cannot let automoc handle them, as the .cpp files don't exist yet when |
105 | | - # cmake is run for the very first time on them -> however the .cpp files might |
106 | | - # exist at a later run. at that time we need to skip them, so that we don't add two |
107 | | - # different rules for the same moc file |
108 | | - GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC) |
109 | | - |
110 | | - IF ( NOT _skip AND EXISTS ${_abs_FILE} ) |
111 | | - |
112 | | - FILE(READ ${_abs_FILE} _contents) |
113 | | - |
114 | | - GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH) |
115 | | - |
116 | | - STRING(REGEX MATCHALL "# *include +[^ ]+\\.moc[\">]" _match "${_contents}") |
117 | | - IF(_match) |
118 | | - FOREACH (_current_MOC_INC ${_match}) |
119 | | - STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}") |
120 | | - |
121 | | - GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE) |
122 | | - IF(EXISTS ${_abs_PATH}/${_basename}.hpp) |
123 | | - SET(_header ${_abs_PATH}/${_basename}.hpp) |
124 | | - ELSE(EXISTS ${_abs_PATH}/${_basename}.hpp) |
125 | | - SET(_header ${_abs_PATH}/${_basename}.h) |
126 | | - ENDIF(EXISTS ${_abs_PATH}/${_basename}.hpp) |
127 | | - SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC}) |
128 | | - QT4_CREATE_MOC_COMMAND(${_header} ${_moc} "${_moc_INCS}" "") |
129 | | - MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc}) |
130 | | - ENDFOREACH (_current_MOC_INC) |
131 | | - ENDIF(_match) |
132 | | - ENDIF ( NOT _skip AND EXISTS ${_abs_FILE} ) |
133 | | - ENDFOREACH (_current_FILE) |
134 | | -ENDMACRO(QT4_AUTOMOC) |
135 | | - |
136 | | - |
137 | 38 | # Portability helpers. |
138 | 39 |
|
139 | 40 | set(QT_QTGUI_LIBRARIES |
@@ -180,69 +81,14 @@ foreach(_module ${_qt_modules}) |
180 | 81 | set(QT_QT${_module_upper}_FOUND ${Qt5${_module}_FOUND}) |
181 | 82 | endforeach() |
182 | 83 |
|
183 | | -list(APPEND QT_QTCORE_LIBRARIES ${Qt5Concurrent_LIBRARIES}) |
184 | 84 | list(APPEND QT_QTCORE_LIBRARY ${Qt5Concurrent_LIBRARIES}) |
185 | 85 |
|
186 | | -list(APPEND QT_QTWEBKIT_LIBRARIES ${Qt5WebKitWidgets_LIBRARIES}) |
187 | 86 | list(APPEND QT_QTWEBKIT_LIBRARY ${Qt5WebKitWidgets_LIBRARIES}) |
188 | 87 |
|
189 | | -set(QT_QTDECLARATIVE_LIBRARIES ${Qt5Quick1_LIBRARIES}) |
190 | | -set(QT_QTDECLARATIVE_LIBRARY ${Qt5Quick1_LIBRARIES}) |
191 | | - |
192 | 88 | Find_Program(QT_LRELEASE_EXECUTABLE NAMES lrelease-qt5 lrelease) |
193 | | -set(QT_LUPDATE_EXECUTABLE lupdate-qt5) |
194 | | - |
195 | | -set(QT_INSTALL_PREFIX ${_qt5Core_install_prefix}) |
196 | | - |
197 | | -get_target_property(QT_QMAKE_EXECUTABLE Qt5::qmake LOCATION) |
198 | | -set(QT_RCC_EXECUTABLE Qt5::rcc LOCATION) |
199 | | -if (TARGET Qt5::uic) |
200 | | - get_target_property(QT_UIC_EXECUTABLE Qt5::uic LOCATION) |
201 | | -endif() |
202 | | - |
203 | | - |
204 | | -if (TARGET Qt5::qdbuscpp2xml) |
205 | | - get_target_property(QT_QDBUSCPP2XML_EXECUTABLE Qt5::qdbuscpp2xml LOCATION) |
206 | | -endif() |
207 | | - |
208 | | -if (TARGET Qt5::qdbusxml2cpp) |
209 | | - get_target_property(QT_QDBUSXML2CPP_EXECUTABLE Qt5::qdbusxml2cpp LOCATION) |
210 | | -endif() |
211 | 89 |
|
212 | 90 | add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) |
213 | 91 |
|
214 | | -macro(qt4_wrap_ui) |
215 | | - qt5_wrap_ui(${ARGN}) |
216 | | -endmacro() |
217 | | - |
218 | | -macro(qt4_wrap_cpp) |
219 | | - qt5_wrap_cpp(${ARGN}) |
220 | | -endmacro() |
221 | | - |
222 | | -macro(qt4_generate_moc) |
223 | | - qt5_generate_moc(${ARGN}) |
224 | | -endmacro() |
225 | | - |
226 | | -macro(qt4_add_dbus_adaptor) |
227 | | - qt5_add_dbus_adaptor(${ARGN}) |
228 | | -endmacro() |
229 | | - |
230 | | -macro(qt4_add_dbus_interfaces) |
231 | | - qt5_add_dbus_interfaces(${ARGN}) |
232 | | -endmacro() |
233 | | - |
234 | | -macro(qt4_add_dbus_interface) |
235 | | - qt5_add_dbus_interface(${ARGN}) |
236 | | -endmacro() |
237 | | - |
238 | | -macro(qt4_generate_dbus_interface) |
239 | | - qt5_generate_dbus_interface(${ARGN}) |
240 | | -endmacro() |
241 | | - |
242 | | -macro(qt4_add_resources) |
243 | | - qt5_add_resources(${ARGN}) |
244 | | -endmacro() |
245 | | - |
246 | 92 | # get the Qt plugins directory |
247 | 93 | GET_TARGET_PROPERTY(QMAKE_EXECUTABLE Qt5::qmake LOCATION) |
248 | 94 | EXEC_PROGRAM(${QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_PLUGINS" RETURN_VALUE return_code OUTPUT_VARIABLE QT_PLUGINS_DIR ) |
0 commit comments