|
|
@@ -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
|
|
|
@@ -100,7 +116,7 @@ if (NOT RCC_DEPENDS)
|
|
|
message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}")
|
|
|
endif()
|
|
|
# Get name and timestamp of the output binary
|
|
|
-file(STRINGS "${RCC_DEPENDS_BIN}/target.txt" targetList)
|
|
|
+file(STRINGS "${RCC_DEPENDS_BIN}/target.txt" targetList ENCODING UTF-8)
|
|
|
list(GET targetList 0 rccDependsBin)
|
|
|
file(TIMESTAMP "${rccDependsBin}" timeBegin "${timeformat}")
|
|
|
# Sleep, touch regular qrc input file, rebuild and compare timestamp
|
|
|
@@ -188,7 +204,7 @@ if (NOT MOC_RERUN)
|
|
|
message(SEND_ERROR "Initial build of mocRerun failed. Output: ${output}")
|
|
|
endif()
|
|
|
# Get name and timestamp of the output binary
|
|
|
-file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/mocRerun/target1.txt" target1List)
|
|
|
+file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/mocRerun/target1.txt" target1List ENCODING UTF-8)
|
|
|
list(GET target1List 0 binFile)
|
|
|
file(TIMESTAMP "${binFile}" timeBegin "${timeformat}")
|
|
|
# Change file content and rebuild
|
|
|
@@ -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
|