summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake/test_moc_macro_target/CMakeLists.txt
diff options
context:
space:
mode:
authorOrkun Tokdemir <orkun.tokdemir@qt.io>2023-07-13 15:30:09 +0200
committerOrkun Tokdemir <orkun.tokdemir@qt.io>2023-08-17 13:09:46 +0200
commitbc0c44d4cd634c574307920968f0ab1bf6cd8305 (patch)
tree2537fe5915bc0daa73611aeef06b2e76d9d3a56c /tests/auto/cmake/test_moc_macro_target/CMakeLists.txt
parent7301cd5cfacd1dd335bd7b3f06b29ce3db0ee8a6 (diff)
_qt_internal_create_moc_command: Fix genex parse
The function was replacing the `>` character in generator expressions coming from `add_compile_definitions`. This was creating generator expression syntax errors. Discard generator expressions from character replacing. Add tests for the three cases. Fixes: QTBUG-111717 Change-Id: I694d2908738085fdf15112834f20183a9f393422 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests/auto/cmake/test_moc_macro_target/CMakeLists.txt')
-rw-r--r--tests/auto/cmake/test_moc_macro_target/CMakeLists.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/cmake/test_moc_macro_target/CMakeLists.txt b/tests/auto/cmake/test_moc_macro_target/CMakeLists.txt
index 1af937bc10..9ed8868097 100644
--- a/tests/auto/cmake/test_moc_macro_target/CMakeLists.txt
+++ b/tests/auto/cmake/test_moc_macro_target/CMakeLists.txt
@@ -24,3 +24,25 @@ qt_wrap_cpp(moc_file mywrapobject.h
add_executable(QtWrapMacroTest main_wrap_test.cpp ${moc_file})
target_include_directories(QtWrapMacroTest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/interface")
target_link_libraries(QtWrapMacroTest PRIVATE Qt::Core)
+
+target_compile_definitions(QtWrapMacroTest PRIVATE "$<$<BOOL:TRUE>:MY_OPTION>"
+ "$<$<BOOL:TRUE>:DEFINE_CMDLINE_SIGNAL=void cmdlineSignal(const QMap<int$<COMMA> int$<ANGLE-R> &i)>"
+ "DEFINE_CMDLINE_SIGNAL=void cmdlineSignal(const QMap<int, int> &i)")
+
+set(parameters_file_base "${CMAKE_CURRENT_BINARY_DIR}/moc_mywrapobject.cpp_parameters")
+# check if generator is multi-config
+if(CMAKE_CONFIGURATION_TYPES)
+ set(parameters_file "${parameters_file_base}_$<CONFIG>")
+else()
+ if(NOT CMAKE_BUILD_TYPE STREQUAL "")
+ set(parameters_file "${parameters_file_base}_${CMAKE_BUILD_TYPE}")
+ else()
+ set(parameters_file "${parameters_file_base}")
+ endif()
+endif()
+
+add_custom_command(TARGET QtWrapMacroTest
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} "-DPARAMETERS_FILE_PATH=${parameters_file}" -P check_moc_parameters.cmake
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+)