blob: 849a733117f963f9bccae557edc6dfc4e6024b2f (
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
|
# Autogen build options
set(Autogen_BUILD_OPTIONS "-DQT_TEST_VERSION=${QT_TEST_VERSION}")
if(NOT CMAKE_CONFIGURATION_TYPES)
list(APPEND Autogen_BUILD_OPTIONS "-DCMAKE_BUILD_TYPE=$<CONFIGURATION>")
endif()
list(APPEND Autogen_BUILD_OPTIONS
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
)
# A macro to add a QtAutogen test
macro(ADD_AUTOGEN_TEST NAME)
if(${ARGC} GREATER 1)
# On Windows there is no RPATH, so while Qt might be available for building,
# the required dlls may not be in the PATH, so we can't run the executables
# on that platform.
if(WIN32)
set(_TestCommand --test-command ${CMAKE_CTEST_COMMAND} -V)
else()
set(_TestCommand --test-command ${ARGN})
endif()
endif()
set(_QtXAutogen "Qt${QT_TEST_VERSION}Autogen")
set(_SourceDir "${CMake_SOURCE_DIR}/Tests/QtAutogen/${NAME}")
set(_BuildDir "${CMake_BINARY_DIR}/Tests/${_QtXAutogen}/${NAME}")
add_test(NAME "${_QtXAutogen}.${NAME}" COMMAND "${CMAKE_CTEST_COMMAND}"
--build-and-test
"${_SourceDir}"
"${_BuildDir}"
${build_generator_args}
--build-project ${NAME}
--build-exe-dir "${_BuildDir}"
--force-new-ctest-process
--build-options ${build_options} ${Autogen_BUILD_OPTIONS}
${_TestCommand}
)
list(APPEND TEST_BUILD_DIRS "${_BuildDir}")
unset(_TestCommand)
unset(_QtXAutogen)
unset(_SourceDir)
unset(_BuildDir)
endmacro()
# Allow using qtx_wrap_cpp and qtx_generate_moc or not
set(ALLOW_WRAP_CPP TRUE)
# Do a simple check if there is are non ASCII character in the build path
string(REGEX MATCH "[^ -~]+" NON_ASCII_BDIR ${CMAKE_CURRENT_BINARY_DIR})
if(NON_ASCII_BDIR)
# Qt4 moc does not support utf8 paths in _parameter files generated by
# qtx_wrap_cpp
# https://bugreports.qt.io/browse/QTBUG-35480
if(QT_TEST_VERSION STREQUAL 4)
set(ALLOW_WRAP_CPP FALSE)
endif()
# On windows qtx_wrap_cpp also fails in Qt5 when used on a path that
# contains non ASCII characters
if(WIN32)
set(ALLOW_WRAP_CPP FALSE)
endif()
endif()
|