PURPOSE "Required for having translations"
)
-# Some Qt5 versions do not define a target for lconvert, so we need to find it ourselves
-if (Qt5LinguistTools_FOUND)
- if (NOT TARGET Qt5::lconvert AND TARGET Qt5::lrelease)
- get_target_property(_lrelease_location Qt5::lrelease LOCATION)
- get_filename_component(_lrelease_path ${_lrelease_location} PATH)
- find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert-qt5 lconvert PATHS ${_lrelease_path} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
- elseif(TARGET Qt5::lconvert AND NOT Qt5_LCONVERT_EXECUTABLE)
- # Newer Qt5 versions define the target, but not the Qt5_LCONVERT_EXECUTABLE variable for some reason
- get_target_property(QT_LCONVERT_EXECUTABLE Qt5::lconvert LOCATION)
- endif()
-
- # Compatibility with the Qt4 variables
- set(QT_LRELEASE_EXECUTABLE ${Qt5_LRELEASE_EXECUTABLE})
- set(QT_LUPDATE_EXECUTABLE ${Qt5_LUPDATE_EXECUTABLE})
- if (Qt5_LCONVERT_EXECUTABLE)
- set(QT_LCONVERT_EXECUTABLE ${Qt5_LCONVERT_EXECUTABLE})
- endif()
-endif()
-
# Non-Qt-based packages
find_package(ZLIB REQUIRED)
add_feature_info("syslog.h" HAVE_SYSLOG "Provide support for logging to the syslog")
endif()
-add_feature_info("Qt Linguist Tools" QT_LCONVERT_EXECUTABLE "Translation support for Quassel")
-
if (EMBED_DATA)
message(STATUS "Embedding data files into the binary")
else()
set(input ${basename}.po)
set(output ${CMAKE_BINARY_DIR}/po/${basename}.ts)
add_custom_command(OUTPUT ${output}
- COMMAND ${QT_LCONVERT_EXECUTABLE}
+ COMMAND $<TARGET_PROPERTY:Qt5::lconvert,LOCATION>
ARGS -i ${input}
-of ts
-o ${output}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/po
# This is a workaround to add (duplicate) strings that lconvert missed to the .ts
- COMMAND ${QT_LUPDATE_EXECUTABLE}
+ COMMAND $<TARGET_PROPERTY:Qt5::lupdate,LOCATION>
ARGS -silent
${CMAKE_SOURCE_DIR}/src/
-ts ${output}
set(input ${CMAKE_BINARY_DIR}/po/${basename}.ts)
set(output ${CMAKE_BINARY_DIR}/po/${basename}.qm)
add_custom_command(OUTPUT ${output}
- COMMAND ${QT_LRELEASE_EXECUTABLE}
+ COMMAND $<TARGET_PROPERTY:Qt5::lrelease,LOCATION>
ARGS -silent
${input}
DEPENDS ${basename}.ts)
# Generate and add translations
# The LINGUAS variable can be used to limit that set
-if(QT_LCONVERT_EXECUTABLE)
+if (TARGET Qt5::lconvert)
# get environment variable for translations
set(LINGUAS "$ENV{LINGUAS}")
string(REGEX REPLACE "[ \t]+" \; output "${LINGUAS}")