diff options
author | Guillaume LE VAILLANT <glv@posteo.net> | 2018-01-09 10:35:14 +0100 |
---|---|---|
committer | Guillaume LE VAILLANT <glv@posteo.net> | 2018-01-09 10:35:14 +0100 |
commit | 64f36300fb8685d6285095ca64d0f383ecc54a95 (patch) | |
tree | 9241a39d7d2b65d2979d23be5db906c747a8d368 /translations | |
parent | Merge pull request #3019 (diff) | |
download | monero-64f36300fb8685d6285095ca64d0f383ecc54a95.tar.xz |
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.
Diffstat (limited to 'translations')
-rw-r--r-- | translations/CMakeLists.txt | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/translations/CMakeLists.txt b/translations/CMakeLists.txt index 36b72d68a..d96326ae0 100644 --- a/translations/CMakeLists.txt +++ b/translations/CMakeLists.txt @@ -35,14 +35,21 @@ if(LRELEASE STREQUAL "LRELEASE-NOTFOUND") set(ts_files "") message(WARNING "lrelease program not found, translation files not built") else() - file(GLOB ts_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.ts) - foreach(ts_file ${ts_files}) - string(REPLACE ".ts" ".qm" qm_file "${ts_file}") - add_custom_command(TARGET generate_translations_header - PRE_BUILD - COMMAND ${LRELEASE} "${CMAKE_CURRENT_SOURCE_DIR}/${ts_file}" -qm "${qm_file}" - WORKING_DIRECTORY "${CMAKE_CURRENT_BIN_DIR}") - endforeach() + 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}) + string(REPLACE ".ts" ".qm" qm_file "${ts_file}") + add_custom_command(TARGET generate_translations_header + PRE_BUILD + COMMAND ${LRELEASE} "${CMAKE_CURRENT_SOURCE_DIR}/${ts_file}" -qm "${qm_file}" + WORKING_DIRECTORY "${CMAKE_CURRENT_BIN_DIR}") + endforeach() + endif() endif() string(REPLACE ".ts" ".qm" qm_files "${ts_files}") |