Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-91250

qt5_create_translation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.12.2
    • Build System: CMake
    • None
    • Windows

    Description

      translation does not work in a typical cmake dynamic library template:

      // заполнитель кода
      cmake_minimum_required(VERSION 3.14)
      
      project(untitled2 LANGUAGES CXX)
      
      set(CMAKE_INCLUDE_CURRENT_DIR ON)
      set(CMAKE_AUTOUIC ON)
      set(CMAKE_AUTOMOC ON)
      set(CMAKE_AUTORCC ON)
      set(CMAKE_CXX_STANDARD 11)
      set(CMAKE_CXX_STANDARD_REQUIRED ON)
      
      find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets LinguistTools REQUIRED)
      find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets LinguistTools REQUIRED)
      
      set(TS_FILES untitled2_ru_RU.ts)
      
      add_library(untitled2 SHARED
        untitled2_global.h
        untitled2.cpp
        untitled2.h
        ${TS_FILES}
      )
      
      target_link_libraries(untitled2 PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
      
      target_compile_definitions(untitled2 PRIVATE UNTITLED2_LIBRARY)
      
      if(COMMAND qt_create_translation)
          qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
      else()
          qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
      endif()
      

      untitled2_ru_RU.ts the file is deleted after applying CMAKE

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtbuildsystem Qt Build System Team
              geniuser Evgeny Glukhovsky
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes