Results 1 to 2 of 2

Thread: CMake: QT5_CREATE_TRANSLATION how to prevent delete existing ts file during clean

  1. #1
    Join Date
    Dec 2009
    Location
    Saint-Peterburg
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default CMake: QT5_CREATE_TRANSLATION how to prevent delete existing ts file during clean

    I use QT5_CREATE_TRANSLATION to keep my ts file in actual state. It is very useful. But when I call make clean my ts files are cleaned also. It is because of

    Qt Code:
    1. add_custom_command(OUTPUT ${_ts_file}
    2. COMMAND ${Qt5_LUPDATE_EXECUTABLE}
    3. ARGS ${_lupdate_options} "@${_ts_lst_file}" -ts ${_ts_file}
    4. DEPENDS ${_my_sources} ${_ts_lst_file} VERBATIM)
    To copy to clipboard, switch view to plain text mode 

    inside the QT5_CREATE_TRANSLATION function.

    Is there way to prevent ts file deletion?

  2. #2
    Join Date
    Dec 2009
    Location
    Saint-Peterburg
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: CMake: QT5_CREATE_TRANSLATION how to prevent delete existing ts file during clean

    I have written the following patch:
    *** C:/Qt/Qt5.0.2/5.0.2/msvc2010/lib/cmake/Qt5LinguistTools/Qt5LinguistToolsMacros.cmake.old Wed Jun 19 12:00:16 2013
    --- C:/Qt/Qt5.0.2/5.0.2/msvc2010/lib/cmake/Qt5LinguistTools/Qt5LinguistToolsMacros.cmake Wed Jun 19 11:48:38 2013
    ***************
    *** 52,57 ****
    --- 52,59 ----
    list(APPEND _my_sources ${_abs_FILE})
    endif()
    endforeach()
    + # declare temp ts files list
    + set(_my_temptsfiles)
    foreach(_ts_file ${_my_tsfiles})
    if(_my_sources)
    # make a list file to call lupdate on, so we don't make our commands too
    ***************
    *** 71,83 ****

    file(WRITE ${_ts_lst_file} "${_lst_file_srcs}")
    endif()
    add_custom_command(
    ! OUTPUT ${_ts_file}
    COMMAND ${Qt5_LUPDATE_EXECUTABLE}
    ARGS ${_lupdate_options} "@${_ts_lst_file}" -ts ${_ts_file}
    DEPENDS ${_my_sources} ${_ts_lst_file} VERBATIM)
    endforeach()
    ! qt5_add_translation(${_qm_files} ${_my_tsfiles})
    set(${_qm_files} ${${_qm_files}} PARENT_SCOPE)
    endfunction()

    --- 73,93 ----

    file(WRITE ${_ts_lst_file} "${_lst_file_srcs}")
    endif()
    + get_filename_component(_ts_nm ${_ts_file} NAME)
    + set(_tmpts_file "${CMAKE_CURRENT_BINARY_DIR}/${_ts_nm}")
    + list(APPEND _my_temptsfiles ${_tmpts_file})
    + get_source_file_property(_qm_output_location ${_ts_file} OUTPUT_LOCATION)
    add_custom_command(
    ! OUTPUT ${_tmpts_file}
    COMMAND ${Qt5_LUPDATE_EXECUTABLE}
    ARGS ${_lupdate_options} "@${_ts_lst_file}" -ts ${_ts_file}
    + COMMAND ${CMAKE_COMMAND} -E copy ${_ts_file} ${_tmpts_file}
    DEPENDS ${_my_sources} ${_ts_lst_file} VERBATIM)
    + if( _qm_output_location )
    + set_property(SOURCE ${_tmpts_file} PROPERTY OUTPUT_LOCATION ${_qm_output_location})
    + endif()
    endforeach()
    ! qt5_add_translation(${_qm_files} ${_my_temptsfiles})
    set(${_qm_files} ${${_qm_files}} PARENT_SCOPE)
    endfunction()

Similar Threads

  1. A problem about "undefined reference to `Clean::Clean(QObject*)'
    By GeorgeDao123 in forum Qt for Embedded and Mobile
    Replies: 4
    Last Post: 10th February 2013, 09:36
  2. QT must clean project to rebuild QML file changes
    By xman_ss in forum Qt Programming
    Replies: 3
    Last Post: 24th November 2011, 03:25
  3. QSharedPointer - how to prevent delete?
    By Piskvorkar in forum Qt Programming
    Replies: 7
    Last Post: 31st March 2010, 15:46
  4. Generating .pro files from vcproj file or CMake file
    By ramazangirgin in forum Qt Programming
    Replies: 2
    Last Post: 17th February 2009, 09:37
  5. Replies: 7
    Last Post: 15th June 2007, 16:13

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.