Check if lrelease is working before trying to use it

On some systems, there is a /usr/bin/lrelease wrapper even if the real
lrelease program is not installed. So let's try to execute lrelease
after it has been found by find_program to see if it is really working.
This commit is contained in:
Guillaume LE VAILLANT 2018-01-09 10:35:14 +01:00
parent a529f0a6c9
commit 64f36300fb
1 changed files with 15 additions and 8 deletions

View File

@ -34,6 +34,12 @@ find_program(LRELEASE lrelease)
if(LRELEASE STREQUAL "LRELEASE-NOTFOUND")
set(ts_files "")
message(WARNING "lrelease program not found, translation files not built")
else()
execute_process(COMMAND ${LRELEASE} -version
RESULT_VARIABLE lrelease_ret)
if(NOT lrelease_ret EQUAL "0")
set(ts_files "")
message(WARNING "lrelease program not working, translation files not built")
else()
file(GLOB ts_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.ts)
foreach(ts_file ${ts_files})
@ -44,6 +50,7 @@ else()
WORKING_DIRECTORY "${CMAKE_CURRENT_BIN_DIR}")
endforeach()
endif()
endif()
string(REPLACE ".ts" ".qm" qm_files "${ts_files}")