--- /dev/null
+# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE\r
+#\r
+# This library is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU Lesser General Public\r
+# License as published by the Free Software Foundation; either\r
+# version 2.1 of the License, or (at your option) any later version.\r
+#\r
+# This library is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+# Lesser General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU Lesser General Public\r
+# License along with this library; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+#\r
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
+#\r
+\r
+IF (QT_VERSION VERSION_LESS "5.0")\r
+ INCLUDE(${QT_USE_FILE})\r
+ENDIF()\r
+\r
+# This MACRO uses the following vars\r
+# - QT_LRELEASE_EXECUTABLE : (given by default by FindQT.cmake)\r
+#\r
+# tsfiles containing all ts files to be compiled.\r
+# installdir contains directory (relative to install_prefix) where to install files after compilation of ts files too qm.\r
+MACRO(QT_INSTALL_TS_RESOURCES tsfiles installdir)\r
+ FOREACH(_input ${tsfiles})\r
+ GET_FILENAME_COMPONENT(_name ${_input} NAME_WE)\r
+ SET(_output ${CMAKE_CURRENT_BINARY_DIR}/${_name}.qm)\r
+ SET(_cmd_${_name} ${QT_LRELEASE_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_input} -qm ${_output})\r
+ ADD_CUSTOM_TARGET(QT_INSTALL_TS_RESOURCES_${_name} ALL COMMAND ${_cmd_${_name}} DEPENDS ${_input})\r
+ INSTALL(FILES ${_output} DESTINATION ${installdir})\r
+ ENDFOREACH()\r
+ENDMACRO(QT_INSTALL_TS_RESOURCES)\r
+\r
+MACRO(QT_WRAP_MOC)\r
+IF (QT_VERSION VERSION_LESS "5.0")\r
+ QT4_WRAP_CPP(${ARGN})\r
+ELSE()\r
+ QT5_WRAP_CPP(${ARGN}) \r
+ # Workaround to avoid problem with bug in moc preprocessor:\r
+ # The problem is reproduced on Linux in case if native system Qt is installed\r
+ # and "-I/usr/include" parameter is presented in the moc command line before\r
+ # custom Qt includes. This bug takes place in Qt-5.6.0 and newer. To avoid this\r
+ # bug move "-I/usr/include" parameter in the "moc parameters" file to the end\r
+ # of the "include section".\r
+ IF (NOT WIN32)\r
+ FOREACH(IT ${ARGN})\r
+ GET_FILENAME_COMPONENT(IT ${IT} ABSOLUTE)\r
+ GET_FILENAME_COMPONENT(PFILE ${IT} NAME_WE)\r
+ SET(OUTFILE ${CMAKE_CURRENT_BINARY_DIR}/moc_${PFILE}.cpp_parameters)\r
+ IF(EXISTS ${OUTFILE}) \r
+ SET(NEW_CONTENT)\r
+ SET(IS_INCLUDE_SECTION TRUE)\r
+ SET(HAS_SYSTEM_INC FALSE)\r
+ FILE(READ ${OUTFILE} CONTENT)\r
+ STRING(REGEX REPLACE "\n" ";" CONTENT "${CONTENT}")\r
+ list(REMOVE_DUPLICATES CONTENT)\r
+ FOREACH(S ${CONTENT})\r
+ IF("${S}" MATCHES "^-I")\r
+ IF("${S}" STREQUAL "-I/usr/include")\r
+ SET(HAS_SYSTEM_INC TRUE)\r
+ ELSE()\r
+ SET(NEW_CONTENT ${NEW_CONTENT} "${S}\n")\r
+ ENDIF()\r
+ ELSE()\r
+ SET(IS_INCLUDE_SECTION FALSE)\r
+ ENDIF()\r
+ IF(NOT IS_INCLUDE_SECTION)\r
+ IF(HAS_SYSTEM_INC)\r
+ SET(NEW_CONTENT ${NEW_CONTENT} "-I/usr/include\n")\r
+ SET(HAS_SYSTEM_INC FALSE)\r
+ ENDIF()\r
+ SET(NEW_CONTENT ${NEW_CONTENT} "${S}\n")\r
+ ENDIF()\r
+ ENDFOREACH()\r
+ FILE(WRITE ${OUTFILE} ${NEW_CONTENT}) \r
+ ENDIF()\r
+ ENDFOREACH()\r
+ ENDIF()\r
+ENDIF()\r
+ENDMACRO(QT_WRAP_MOC)\r
+\r
+MACRO(QT_WRAP_UIC)\r
+IF (QT_VERSION VERSION_LESS "5.0")\r
+ QT4_WRAP_UI(${ARGN})\r
+ELSE()\r
+ QT5_WRAP_UI(${ARGN})\r
+ENDIF()\r
+ENDMACRO(QT_WRAP_UIC)\r
+\r
+MACRO(QT_ADD_RESOURCES)\r
+IF (QT_VERSION VERSION_LESS "5.0")\r
+ QT4_ADD_RESOURCES(${ARGN})\r
+ELSE()\r
+ QT5_ADD_RESOURCES(${ARGN})\r
+ENDIF()\r
+ENDMACRO(QT_ADD_RESOURCES)\r