mirror of
https://github.com/chris2511/xca.git
synced 2026-09-12 19:51:05 +05:00
Use Qt6 qt_add_translations to generate translation targets
Keep "trans" target to also update the POT file.
This commit is contained in:
parent
f766fcbe48
commit
a548227a07
@ -33,12 +33,12 @@ set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC_SEARCH_PATHS "${PROJECT_SOURCE_DIR}/ui")
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
add_compile_definitions(OPENSSL_SUPPRESS_DEPRECATED)
|
||||
file(GLOB UI_FILES ${CMAKE_AUTOUIC_SEARCH_PATHS}/*.ui)
|
||||
|
||||
configure_file(local.h.in local.h)
|
||||
|
||||
##### Libraries and executables
|
||||
|
||||
add_executable(${CMAKE_PROJECT_NAME} img/imgres.qrc ${PROJECT_BINARY_DIR}/local.h)
|
||||
add_executable(${CMAKE_PROJECT_NAME} img/imgres.qrc ${UI_FILES} ${PROJECT_BINARY_DIR}/local.h)
|
||||
add_executable(xcadoc ${PROJECT_BINARY_DIR}/local.h)
|
||||
|
||||
include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
|
||||
|
||||
@ -25,19 +25,19 @@ string(APPEND WIX_LANG_CONTENT
|
||||
)
|
||||
|
||||
WixFile(${D}/language.wxs ${WIX_LANG_CONTENT})
|
||||
if(NOT TRANS)
|
||||
if (${QT_VERSION} VERSION_LESS 6.0.0)
|
||||
qt5_add_translation(QM_FILES ${TS_FILES} OPTIONS -silent)
|
||||
else()
|
||||
qt_add_translation(QM_FILES ${TS_FILES} OPTIONS -silent)
|
||||
endif()
|
||||
if (${QT_VERSION} VERSION_LESS 6.0.0 )
|
||||
qt5_add_translation(QM_FILES ${TS_FILES} OPTIONS -silent)
|
||||
message(STATUS "Updating translations from source with 'lupdate' only supprted with QT6")
|
||||
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${QM_FILES})
|
||||
else()
|
||||
qt_add_translations(xca TS_FILES ${TS_FILES} ${S}/xca.ts
|
||||
LRELEASE_OPTIONS -silent
|
||||
QM_FILES_OUTPUT_VARIABLE QM_FILES
|
||||
)
|
||||
add_custom_target(trans DEPENDS xca_lupdate "${S}/xca.pot")
|
||||
endif()
|
||||
list(APPEND APP_RESOURCES ${QM_FILES})
|
||||
|
||||
add_custom_target(translations DEPENDS ${QM_FILES})
|
||||
add_dependencies(${CMAKE_PROJECT_NAME} translations)
|
||||
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${QM_FILES})
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
install(FILES ${QM_FILES}
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}/i18n
|
||||
@ -49,20 +49,9 @@ elseif(WIN32)
|
||||
endif()
|
||||
|
||||
find_program(LCONVERT lconvert)
|
||||
|
||||
# cmake -DTRANS=1 ../xca && make trans
|
||||
if (LCONVERT AND TRANS)
|
||||
add_custom_command(
|
||||
add_custom_command(
|
||||
OUTPUT "${S}/xca.pot"
|
||||
COMMAND ${LCONVERT} -if ts -of po -i "${S}/xca.ts" -o "${S}/xca.pot"
|
||||
DEPENDS "${S}/xca.ts"
|
||||
COMMENT "Update POT file"
|
||||
)
|
||||
if (${QT_VERSION} VERSION_LESS 6.0.0)
|
||||
qt5_create_translation(CQM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
||||
else()
|
||||
qt_create_translation(CQM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
||||
endif()
|
||||
|
||||
add_custom_target(trans DEPENDS ${CQM_FILES} "${S}/xca.pot")
|
||||
endif()
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user