1 # Autogen build options
2 set(Autogen_BUILD_OPTIONS "-DQT_TEST_VERSION=${QT_TEST_VERSION}")
3 if(_isMultiConfig) # Set in Tests/CMakeLists.txt
4 list(APPEND Autogen_CTEST_OPTIONS --build-config $<CONFIGURATION>)
6 list(APPEND Autogen_BUILD_OPTIONS "-DCMAKE_BUILD_TYPE=$<CONFIGURATION>")
8 list(APPEND Autogen_BUILD_OPTIONS
9 "-DCMAKE_AUTOGEN_VERBOSE=1"
11 if(Qt${QT_TEST_VERSION}Core_DIR)
12 get_filename_component(prefix "${Qt${QT_TEST_VERSION}Core_DIR}" DIRECTORY)
13 get_filename_component(prefix "${prefix}" DIRECTORY)
14 get_filename_component(prefix "${prefix}" DIRECTORY)
15 list(APPEND Autogen_BUILD_OPTIONS "-DCMAKE_PREFIX_PATH:STRING=${prefix}")
17 list(APPEND Autogen_BUILD_OPTIONS
18 "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
21 # XXX(xcode-per-cfg-src): Drop the NO_PER_CONFIG_SOURCES exclusion
22 # when the Xcode generator supports per-config sources.
23 if(CMAKE_GENERATOR STREQUAL "Xcode")
24 list(APPEND Autogen_BUILD_OPTIONS -DNO_PER_CONFIG_SOURCES=1)
27 # A macro to add a QtAutogen test
28 macro(ADD_AUTOGEN_TEST NAME)
30 # On Windows there is no RPATH, so while Qt might be available for building,
31 # the required dlls may not be in the PATH, so we can't run the executables
34 set(_TestCommand --test-command ${CMAKE_CTEST_COMMAND} -V)
36 set(_TestCommand --test-command ${ARGN})
40 set(_QtXAutogen "Qt${QT_TEST_VERSION}Autogen")
41 set(_SourceDir "${CMake_SOURCE_DIR}/Tests/QtAutogen/${NAME}")
42 set(_BuildDir "${CMake_BINARY_DIR}/Tests/${_QtXAutogen}/${NAME}")
43 add_test(NAME "${_QtXAutogen}.${NAME}" COMMAND "${CMAKE_CTEST_COMMAND}"
47 ${build_generator_args}
48 --build-project ${NAME}
49 ${Autogen_CTEST_OPTIONS}
50 --build-exe-dir "${_BuildDir}"
51 --force-new-ctest-process
52 --build-options ${build_options} ${Autogen_BUILD_OPTIONS}
55 set_tests_properties("${_QtXAutogen}.${NAME}" PROPERTIES LABELS "Qt${QT_TEST_VERSION}")
56 list(APPEND TEST_BUILD_DIRS "${_BuildDir}")
63 # Allow using qtx_wrap_cpp and qtx_generate_moc or not
64 set(QT_TEST_ALLOW_QT_MACROS TRUE)
65 # Do a simple check if there is are non ASCII character in the build path
66 string(REGEX MATCH "[^ -~]+" NON_ASCII_BDIR ${CMAKE_CURRENT_BINARY_DIR})
68 # Qt4 moc does not support utf8 paths in _parameter files generated by
70 # https://bugreports.qt.io/browse/QTBUG-35480
71 if(QT_TEST_VERSION EQUAL 4)
72 set(QT_TEST_ALLOW_QT_MACROS FALSE)
74 # On windows qtx_wrap_cpp also fails in Qt5 when used on a path that
75 # contains non ASCII characters
77 set(QT_TEST_ALLOW_QT_MACROS FALSE)