forked from qt-creator/qt-creator
Fix use of translations in Qt wizards for Qt 6
qt_create_translation was introduced in Qt 5.15. But we also still support older Qt versions, so we cannot use it unconditionally. Fixes: QTCREATORBUG-25070 Change-Id: I81de7e19b42e0e8cb9cb23e14909e71c534dc0da Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
@@ -30,5 +30,9 @@ add_executable(%{ProjectName}
|
|||||||
target_link_libraries(%{ProjectName} Qt${QT_VERSION_MAJOR}::Core)
|
target_link_libraries(%{ProjectName} Qt${QT_VERSION_MAJOR}::Core)
|
||||||
@if %{HasTranslation}
|
@if %{HasTranslation}
|
||||||
|
|
||||||
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
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()
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
@@ -46,5 +46,9 @@ target_compile_definitions(%{ProjectName} PRIVATE %{LibraryDefine})
|
|||||||
@endif
|
@endif
|
||||||
@if %{HasTranslation}
|
@if %{HasTranslation}
|
||||||
|
|
||||||
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
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()
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
|||||||
qt_add_executable(%{ProjectName}
|
qt_add_executable(%{ProjectName}
|
||||||
${PROJECT_SOURCES}
|
${PROJECT_SOURCES}
|
||||||
)
|
)
|
||||||
|
@if %{HasTranslation}
|
||||||
|
|
||||||
|
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
||||||
|
@endif
|
||||||
else()
|
else()
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_library(%{ProjectName} SHARED
|
add_library(%{ProjectName} SHARED
|
||||||
@@ -56,13 +60,13 @@ else()
|
|||||||
${PROJECT_SOURCES}
|
${PROJECT_SOURCES}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@if %{HasTranslation}
|
||||||
|
|
||||||
|
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
||||||
|
@endif
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(%{ProjectName}
|
target_compile_definitions(%{ProjectName}
|
||||||
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
||||||
target_link_libraries(%{ProjectName}
|
target_link_libraries(%{ProjectName}
|
||||||
PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick)
|
PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick)
|
||||||
@if %{HasTranslation}
|
|
||||||
|
|
||||||
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
|
||||||
@endif
|
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
|||||||
qt_add_executable(%{ProjectName}
|
qt_add_executable(%{ProjectName}
|
||||||
${PROJECT_SOURCES}
|
${PROJECT_SOURCES}
|
||||||
)
|
)
|
||||||
|
@if %{HasTranslation}
|
||||||
|
|
||||||
|
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
||||||
|
@endif
|
||||||
else()
|
else()
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_library(%{ProjectName} SHARED
|
add_library(%{ProjectName} SHARED
|
||||||
@@ -60,10 +64,10 @@ else()
|
|||||||
${PROJECT_SOURCES}
|
${PROJECT_SOURCES}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@if %{HasTranslation}
|
||||||
|
|
||||||
|
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
||||||
|
@endif
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(%{ProjectName} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
|
target_link_libraries(%{ProjectName} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
@if %{HasTranslation}
|
|
||||||
|
|
||||||
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
|
||||||
@endif
|
|
||||||
|
|||||||
Reference in New Issue
Block a user