diff options
author | Aurélien Gâteau <agateau@kde.org> | 2014-05-04 20:43:42 +0100 |
---|---|---|
committer | Alex Merry <alex.merry@kde.org> | 2014-05-04 20:59:53 +0100 |
commit | 73992f139276b75aeddf78f476644a2d82f9e802 (patch) | |
tree | 109b63c6061a2e8f39454a7d069643fd5d2050cb /tests/ECMPoQmToolsTest/check_tree.cmake.in | |
parent | 09d355975a6b9d3f89da280627a71e46c606d563 (diff) | |
download | extra-cmake-modules-73992f139276b75aeddf78f476644a2d82f9e802.tar.gz extra-cmake-modules-73992f139276b75aeddf78f476644a2d82f9e802.tar.bz2 |
Add ECMPoQmTools module
ecm_create_qm_from_po_files() was actually not very useful in practice.
So that is deprecated, to be removed before ECM 1.0.
Instead, the ECMPoQmTools provides several useful functions:
ecm_create_qm_loader() (which already existed in
ECMCreateQmFromPoFiles), ecm_process_po_files_as_qm() (which has the
same signature as gettext_process_po_files() from the FindGettext
module) and ecm_install_po_files_as_qm(), which is a convenience
function mostly for the benefit of KDE Frameworks (although potentially
useful for whatever other projects have the unusual requirement of a
Gettext translation workflow but no Gettext usage in the code).
NB: some clean-up to the documentation was done by Alex Merry
<alex.merry@kde.org> as part of this commit.
REVIEW: 117823
Diffstat (limited to 'tests/ECMPoQmToolsTest/check_tree.cmake.in')
-rw-r--r-- | tests/ECMPoQmToolsTest/check_tree.cmake.in | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/ECMPoQmToolsTest/check_tree.cmake.in b/tests/ECMPoQmToolsTest/check_tree.cmake.in new file mode 100644 index 00000000..71cbaa8d --- /dev/null +++ b/tests/ECMPoQmToolsTest/check_tree.cmake.in @@ -0,0 +1,55 @@ +set(BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@") +set(ACTUAL_TREE "@CMAKE_INSTALL_PREFIX@") +set(QMLOADER_PATH "@QMLOADER_PATH@") + +set(fail OFF) + +macro(mark_failed msg) + message(WARNING "FAIL: ${msg}") + set(fail ON) +endmacro() + +macro(check_strequal var expected) + if (NOT "${${var}}" STREQUAL "${expected}") + mark_failed("${var} is:\n \"${${var}}\"\nExpected:\n \"${expected}\"") + endif() +endmacro() + +macro(check_exists file) + if (NOT EXISTS ${file}) + mark_failed("File \"${file}\" does not exist") + endif() +endmacro() + +check_exists(${BINARY_DIR}/ECMQmLoader.cpp) +check_strequal(QMLOADER_PATH "${BINARY_DIR}/ECMQmLoader.cpp") + +set(exp_files + "share/locale/fr/LC_MESSAGES/test.qm" + "share/locale/fr/LC_MESSAGES/install-test.qm" + "share/locale/es/LC_MESSAGES/install-test.qm" +) +file(GLOB_RECURSE actual_files RELATIVE "${ACTUAL_TREE}" "${ACTUAL_TREE}/*") +list(SORT exp_files) +list(SORT actual_files) + +if(NOT exp_files STREQUAL actual_files) + foreach(f ${exp_files}) + list(FIND actual_files "${f}" result) + if(result EQUAL -1) + message(WARNING "${f} was expected, but not found") + set(fail ON) + endif() + endforeach() + foreach(f ${actual_files}) + list(FIND exp_files "${f}" result) + if(result EQUAL -1) + message(WARNING "${f} was found, but not expected") + set(fail ON) + endif() + endforeach() +endif() + +if (fail) + message("Test failed!") +endif() |