Salome HOME
Copyright update: 2016
[modules/gui.git] / adm_local / cmake_files / UseQt4Ext.cmake
1 # Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 INCLUDE(${QT_USE_FILE})
21
22 INSTALL(CODE "MACRO(QT4_COMPILE_TS_ON_INSTALL MYLRELEASE MYTSFILE MYFULLDIR MYOUTQMFILE)
23   FILE(MAKE_DIRECTORY \${MYFULLDIR})
24   MESSAGE(STATUS \"Compiling \${MYTSFILE}\")
25   EXECUTE_PROCESS(COMMAND \${MYLRELEASE} \${MYTSFILE} -qm \${MYFULLDIR}/\${MYOUTQMFILE})
26 ENDMACRO(QT4_COMPILE_TS_ON_INSTALL)")
27
28 # This MACRO uses the following vars
29 # - QT_LRELEASE_EXECUTABLE : (given by default by FindQT.cmake)
30 #
31 # MYTSFILES containing all ts files to be compiled.
32 # WHERETOINSTALL contains directory (relative to install_prefix) where to install files after compilation of ts files too qm.
33 MACRO(QT4_INSTALL_TS_RESOURCES MYTSFILES WHERETOINSTALL)
34   INSTALL(CODE "SET(INSTALL_TS_DIR ${WHERETOINSTALL})")
35   SET(MYSOURCES)
36   FOREACH(input ${MYTSFILES})
37     GET_FILENAME_COMPONENT(input2 ${input} NAME)
38     STRING(REGEX REPLACE ".ts" "" base ${input2})
39     SET(output "${base}.qm")
40     INSTALL(CODE "QT4_COMPILE_TS_ON_INSTALL( \"${QT_LRELEASE_EXECUTABLE}\" \"${CMAKE_CURRENT_SOURCE_DIR}/${input}\" \"${CMAKE_INSTALL_PREFIX}/\${INSTALL_TS_DIR}\" ${output})")
41   ENDFOREACH(input ${MYIDLFILES})
42 ENDMACRO(QT4_INSTALL_TS_RESOURCES)