diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2014-04-16 13:40:21 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-16 16:23:38 +0200 |
commit | e47fbace5be156683b905f82975ede8d12fa1848 (patch) | |
tree | 7adf43917282697774adf875642269818e1c194b | |
parent | 2fd07fba2746464178cb7aae4342aa6c998e5a5a (diff) | |
download | qttools-e47fbace5be156683b905f82975ede8d12fa1848.tar.gz |
CMake: Check that executables in the linguist package exist before use.
Change-Id: Ifaaff157a836e3ebfb94b563631b65a226ed0d8c
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
-rw-r--r-- | src/linguist/Qt5LinguistToolsConfig.cmake.in | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/linguist/Qt5LinguistToolsConfig.cmake.in b/src/linguist/Qt5LinguistToolsConfig.cmake.in index ce71646f3..ac598c211 100644 --- a/src/linguist/Qt5LinguistToolsConfig.cmake.in +++ b/src/linguist/Qt5LinguistToolsConfig.cmake.in @@ -27,27 +27,47 @@ get_filename_component(_qt5_linguisttools_install_prefix \"${CMAKE_CURRENT_LIST_ set(_qt5_linguisttools_install_prefix \"$$[QT_INSTALL_PREFIX]\") !!ENDIF +macro(_qt5_LinguistTools_check_file_exists file) + if(NOT EXISTS \"${file}\" ) + message(FATAL_ERROR \"The package \\\"Qt5LinguistTools\\\" references the file + \\\"${file}\\\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \\\"${CMAKE_CURRENT_LIST_FILE}\\\" +but not all the files it references. +\") + endif() +endmacro() + if (NOT TARGET Qt5::lrelease) add_executable(Qt5::lrelease IMPORTED) - set_target_properties(Qt5::lrelease PROPERTIES !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) - IMPORTED_LOCATION \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\" + set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\") !!ELSE - IMPORTED_LOCATION \"$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\" + set(imported_location \"$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\") !!ENDIF + _qt5_LinguistTools_check_file_exists(${imported_location}) + + set_target_properties(Qt5::lrelease PROPERTIES + IMPORTED_LOCATION ${imported_location} ) endif() if (NOT TARGET Qt5::lupdate) add_executable(Qt5::lupdate IMPORTED) - set_target_properties(Qt5::lupdate PROPERTIES !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE) - IMPORTED_LOCATION \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\" + set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\") !!ELSE - IMPORTED_LOCATION \"$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\" + set(imported_location \"$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\") !!ENDIF + _qt5_LinguistTools_check_file_exists(${imported_location}) + + set_target_properties(Qt5::lupdate PROPERTIES + IMPORTED_LOCATION ${imported_location} ) endif() |