Qt4Macros: Only cut last extension (".ts") and replace it with ".qm"

This commit is contained in:
Kai Blaschke 2020-01-13 15:58:55 +01:00 committed by Craig Scott
parent e4c0711602
commit fd83dab339

View File

@ -436,7 +436,7 @@ macro(QT4_CREATE_TRANSLATION _qm_files)
if(_my_sources)
# make a .pro file to call lupdate on, so we don't make our commands too
# long for some systems
get_filename_component(_ts_name ${_ts_file} NAME_WE)
get_filename_component(_ts_name ${_ts_file} NAME)
set(_ts_pro ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lupdate.pro)
set(_pro_srcs)
foreach(_pro_src ${_my_sources})
@ -463,13 +463,15 @@ endmacro()
macro(QT4_ADD_TRANSLATION _qm_files)
foreach (_current_FILE ${ARGN})
get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
get_filename_component(qm ${_abs_FILE} NAME_WE)
get_property(output_location SOURCE ${_abs_FILE} PROPERTY OUTPUT_LOCATION)
get_filename_component(qm ${_abs_FILE} NAME)
# everything before the last dot has to be considered the file name (including other dots)
string(REGEX REPLACE "\\.[^.]*$" "" FILE_NAME ${qm})
get_source_file_property(output_location ${_abs_FILE} OUTPUT_LOCATION)
if(output_location)
file(MAKE_DIRECTORY "${output_location}")
set(qm "${output_location}/${qm}.qm")
set(qm "${output_location}/${FILE_NAME}.qm")
else()
set(qm "${CMAKE_CURRENT_BINARY_DIR}/${qm}.qm")
set(qm "${CMAKE_CURRENT_BINARY_DIR}/${FILE_NAME}.qm")
endif()
add_custom_command(OUTPUT ${qm}