1 # Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
\r
3 # This library is free software; you can redistribute it and/or
\r
4 # modify it under the terms of the GNU Lesser General Public
\r
5 # License as published by the Free Software Foundation; either
\r
6 # version 2.1 of the License, or (at your option) any later version.
\r
8 # This library is distributed in the hope that it will be useful,
\r
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
11 # Lesser General Public License for more details.
\r
13 # You should have received a copy of the GNU Lesser General Public
\r
14 # License along with this library; if not, write to the Free Software
\r
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
\r
20 IF (QT_VERSION VERSION_LESS "5.0")
\r
21 INCLUDE(${QT_USE_FILE})
\r
24 # This MACRO uses the following vars
\r
25 # - QT_LRELEASE_EXECUTABLE : (given by default by FindQT.cmake)
\r
27 # tsfiles containing all ts files to be compiled.
\r
28 # installdir contains directory (relative to install_prefix) where to install files after compilation of ts files too qm.
\r
29 MACRO(QT_INSTALL_TS_RESOURCES tsfiles installdir)
\r
30 FOREACH(_input ${tsfiles})
\r
31 GET_FILENAME_COMPONENT(_name ${_input} NAME_WE)
\r
32 SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_name}.qm)
\r
33 SET(_cmd_${_name} ${QT_LRELEASE_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_input} -qm ${_output})
\r
34 ADD_CUSTOM_TARGET(QT_INSTALL_TS_RESOURCES_${_name} ALL COMMAND ${_cmd_${_name}} DEPENDS ${_input})
\r
35 INSTALL(FILES ${_output} DESTINATION ${installdir})
\r
37 ENDMACRO(QT_INSTALL_TS_RESOURCES)
\r
40 IF (QT_VERSION VERSION_LESS "5.0")
\r
41 QT4_WRAP_CPP(${ARGN})
\r
43 QT5_WRAP_CPP(${ARGN})
\r
44 # Workaround to avoid problem with bug in moc preprocessor:
\r
45 # The problem is reproduced on Linux in case if native system Qt is installed
\r
46 # and "-I/usr/include" parameter is presented in the moc command line before
\r
47 # custom Qt includes. This bug takes place in Qt-5.6.0 and newer. To avoid this
\r
48 # bug move "-I/usr/include" parameter in the "moc parameters" file to the end
\r
49 # of the "include section".
\r
52 GET_FILENAME_COMPONENT(IT ${IT} ABSOLUTE)
\r
53 GET_FILENAME_COMPONENT(PFILE ${IT} NAME_WE)
\r
54 SET(OUTFILE ${CMAKE_CURRENT_BINARY_DIR}/moc_${PFILE}.cpp_parameters)
\r
55 IF(EXISTS ${OUTFILE})
\r
57 SET(IS_INCLUDE_SECTION TRUE)
\r
58 SET(HAS_SYSTEM_INC FALSE)
\r
59 FILE(READ ${OUTFILE} CONTENT)
\r
60 STRING(REGEX REPLACE "\n" ";" CONTENT "${CONTENT}")
\r
61 list(REMOVE_DUPLICATES CONTENT)
\r
62 FOREACH(S ${CONTENT})
\r
63 IF("${S}" MATCHES "^-I")
\r
64 IF("${S}" STREQUAL "-I/usr/include")
\r
65 SET(HAS_SYSTEM_INC TRUE)
\r
67 SET(NEW_CONTENT ${NEW_CONTENT} "${S}\n")
\r
70 SET(IS_INCLUDE_SECTION FALSE)
\r
72 IF(NOT IS_INCLUDE_SECTION)
\r
74 SET(NEW_CONTENT ${NEW_CONTENT} "-I/usr/include\n")
\r
75 SET(HAS_SYSTEM_INC FALSE)
\r
77 SET(NEW_CONTENT ${NEW_CONTENT} "${S}\n")
\r
80 FILE(WRITE ${OUTFILE} ${NEW_CONTENT})
\r
85 ENDMACRO(QT_WRAP_MOC)
\r
88 IF (QT_VERSION VERSION_LESS "5.0")
\r
89 QT4_WRAP_UI(${ARGN})
\r
91 QT5_WRAP_UI(${ARGN})
\r
93 ENDMACRO(QT_WRAP_UIC)
\r
95 MACRO(QT_ADD_RESOURCES)
\r
96 IF (QT_VERSION VERSION_LESS "5.0")
\r
97 QT4_ADD_RESOURCES(${ARGN})
\r
99 QT5_ADD_RESOURCES(${ARGN})
\r
101 ENDMACRO(QT_ADD_RESOURCES)
\r