blob: 9f4f7c0d19f286647ad1c9c99362bd921ff01cba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
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")
check_exists(${BINARY_DIR}/fr/only-process.qm)
set(exp_files
"share/locale/fr/LC_MESSAGES/process-and-install.qm"
"share/locale/es/LC_MESSAGES/install-test.qm"
"share/locale/fr/LC_MESSAGES/install-test.qm"
"custom-dir1/es/LC_MESSAGES/custom-dir1-install-test.qm"
"custom-dir1/fr/LC_MESSAGES/custom-dir1-install-test.qm"
"custom-dir2/es/LC_MESSAGES/custom-dir2-install-test.qm"
"custom-dir2/fr/LC_MESSAGES/custom-dir2-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(FATAL_ERROR "Test failed!")
endif()
|