ENH: Fix #7433. Put list of files in a .pro file and call lupdate on it,

instead of putting the list of files on the command line.
This commit is contained in:
Clinton Stimpson 2008-09-22 15:00:31 -04:00
parent 67dc176ffa
commit 33e87980cb
1 changed files with 17 additions and 3 deletions

View File

@ -1295,21 +1295,35 @@ IF (QT4_QMAKE_FOUND)
MACRO(QT4_CREATE_TRANSLATION _qm_files)
QT4_EXTRACT_OPTIONS(_lupdate_files _lupdate_options ${ARGN})
SET(_my_sources)
SET(_my_dirs)
SET(_my_tsfiles)
SET(_ts_pro)
FOREACH (_file ${_lupdate_files})
GET_FILENAME_COMPONENT(_ext ${_file} EXT)
GET_FILENAME_COMPONENT(_abs_FILE ${_file} ABSOLUTE)
IF(_ext MATCHES "ts")
LIST(APPEND _my_tsfiles ${_abs_FILE})
ELSE(_ext MATCHES "ts")
LIST(APPEND _my_sources ${_abs_FILE})
IF(NOT _ext)
LIST(APPEND _my_dirs ${_abs_FILE})
ELSE(NOT _ext)
LIST(APPEND _my_sources ${_abs_FILE})
ENDIF(NOT _ext)
ENDIF(_ext MATCHES "ts")
ENDFOREACH(_file)
FOREACH(_ts_file ${_my_tsfiles})
IF(_my_sources)
# make a .pro file to call lupdate on, so we don't make our commands too
# long for some systems
GET_FILENAME_COMPONENT(_ts_name ${_ts_file} NAME_WE)
SET(_ts_pro ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lupdate.pro)
STRING(REPLACE ";" " " _pro_srcs "${_my_sources}")
FILE(WRITE ${_ts_pro} "SOURCES = ${_pro_srcs}")
ENDIF(_my_sources)
ADD_CUSTOM_COMMAND(OUTPUT ${_ts_file}
COMMAND ${QT_LUPDATE_EXECUTABLE}
ARGS ${_lupdate_options} ${_my_sources} -ts ${_ts_file}
DEPENDS ${_my_sources})
ARGS ${_lupdate_options} ${_ts_pro} ${_my_dirs} -ts ${_ts_file}
DEPENDS ${_my_sources} ${_ts_pro})
ENDFOREACH(_ts_file)
QT4_ADD_TRANSLATION(${_qm_files} ${_my_tsfiles})
ENDMACRO(QT4_CREATE_TRANSLATION)