Autogen: Tests: Disable some tests on non ASCII build paths

This commit is contained in:
Sebastian Holtermann 2017-06-13 11:25:45 +02:00
parent 38e3fc4bdd
commit 7f68ad6612
2 changed files with 51 additions and 23 deletions

View File

@ -20,6 +20,16 @@ if (WIN32)
endif()
endif()
# Qt4 moc does not support utf8 paths in _parameter files generated by
# qt4_wrap_cpp and qt4_generate_moc
# https://bugreports.qt.io/browse/QTBUG-35480
# 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)
message(WARNING "Build path contains non ASCII characters. Skipping Qt4 test.")
return()
endif()
qt4_generate_moc(main_gen_test.cpp
"${CMAKE_CURRENT_BINARY_DIR}/main_gen_test.moc"
TARGET Qt4GenerateMacroTest

View File

@ -46,6 +46,20 @@ endif()
get_property(QT_COMPILE_FEATURES TARGET ${QT_QTCORE_TARGET} PROPERTY INTERFACE_COMPILE_FEATURES)
# Qt4 moc does not support utf8 paths in _parameter files generated by
# qtx_wrap_cpp
# https://bugreports.qt.io/browse/QTBUG-35480
# 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((NOT NON_ASCII_BDIR) OR (NOT QT_TEST_VERSION STREQUAL 4))
set(ALLOW_WRAP_CPP TRUE)
endif()
# On windows qtx_wrap_cpp also fails in Qt5 when used on a path that
# contains non ASCII characters
if(NON_ASCII_BDIR AND WIN32)
set(ALLOW_WRAP_CPP FALSE)
endif()
# -- Test
# RCC only
add_executable(rccOnly rccOnly.cpp rccOnlyRes.qrc)
@ -60,10 +74,12 @@ target_link_libraries(rccEmpty ${QT_QTCORE_TARGET})
# -- Test
# UIC only
qtx_wrap_cpp(uicOnlyMoc uicOnlySource/uiconly.h)
add_executable(uicOnly uicOnlySource/uiconly.cpp ${uicOnlyMoc})
set_property(TARGET uicOnly PROPERTY AUTOUIC ON)
target_link_libraries(uicOnly ${QT_LIBRARIES})
if(ALLOW_WRAP_CPP)
qtx_wrap_cpp(uicOnlyMoc uicOnlySource/uiconly.h)
add_executable(uicOnly uicOnlySource/uiconly.cpp ${uicOnlyMoc})
set_property(TARGET uicOnly PROPERTY AUTOUIC ON)
target_link_libraries(uicOnly ${QT_LIBRARIES})
endif()
# -- Test
# Add not_generated_file.qrc to the source list to get the file-level
@ -209,25 +225,27 @@ endif()
# -- Test
# Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target
qtx_wrap_cpp(skipMocWrapMoc
skipSource/qItemA.hpp
skipSource/qItemB.hpp)
set(skipMocSources
skipMoc.cpp
skipSource/qItemA.cpp
skipSource/qItemB.cpp
skipSource/qItemC.cpp)
set_property(SOURCE skipSource/qItemA.cpp PROPERTY SKIP_AUTOMOC ON)
set_property(SOURCE skipSource/qItemB.cpp PROPERTY SKIP_AUTOGEN ON)
# AUTOMOC enabled only
add_executable(skipMocA ${skipMocSources} ${skipMocWrapMoc})
set_property(TARGET skipMocA PROPERTY AUTOMOC ON)
target_link_libraries(skipMocA ${QT_LIBRARIES})
# AUTOMOC and AUTOUIC enabled
add_executable(skipMocB ${skipMocSources} ${skipMocWrapMoc})
set_property(TARGET skipMocB PROPERTY AUTOMOC ON)
set_property(TARGET skipMocB PROPERTY AUTOUIC ON)
target_link_libraries(skipMocB ${QT_LIBRARIES})
if(ALLOW_WRAP_CPP)
qtx_wrap_cpp(skipMocWrapMoc
skipSource/qItemA.hpp
skipSource/qItemB.hpp)
set(skipMocSources
skipMoc.cpp
skipSource/qItemA.cpp
skipSource/qItemB.cpp
skipSource/qItemC.cpp)
set_property(SOURCE skipSource/qItemA.cpp PROPERTY SKIP_AUTOMOC ON)
set_property(SOURCE skipSource/qItemB.cpp PROPERTY SKIP_AUTOGEN ON)
# AUTOMOC enabled only
add_executable(skipMocA ${skipMocSources} ${skipMocWrapMoc})
set_property(TARGET skipMocA PROPERTY AUTOMOC ON)
target_link_libraries(skipMocA ${QT_LIBRARIES})
# AUTOMOC and AUTOUIC enabled
add_executable(skipMocB ${skipMocSources} ${skipMocWrapMoc})
set_property(TARGET skipMocB PROPERTY AUTOMOC ON)
set_property(TARGET skipMocB PROPERTY AUTOUIC ON)
target_link_libraries(skipMocB ${QT_LIBRARIES})
endif()
# -- Test
# Test for SKIP_AUTOUIC and SKIP_AUTOGEN on an AUTOUIC enabled target