summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake/test_moc_macro_target/CMakeLists.txt
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2013-06-19 17:56:04 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-21 16:39:55 +0200
commit8074693425e06d2c4a8f130124658fe72f3e5ab9 (patch)
tree2523d10b7e50dc6df7c95845157e059d42de19a9 /tests/auto/cmake/test_moc_macro_target/CMakeLists.txt
parentee50096830f7915db2078ad66d83283e3c97f5d9 (diff)
CMake: Allow specifying a TARGET in invocations of macros.
Forward-port of 9ce60ff509c4ff27fe861fc5b2080f50897a68c4 (Qt4Macros: Allow specifying a TARGET in invokations of macros., 2013-02-26) from cmake.git. This causes the INCLUDE_DIRECTORIES and COMPILE_DEFINITIONS to be used from the specified target when running moc. Change-Id: I868a35ade3c6b059e64d226291cf2046709d86d4 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests/auto/cmake/test_moc_macro_target/CMakeLists.txt')
-rw-r--r--tests/auto/cmake/test_moc_macro_target/CMakeLists.txt23
1 files changed, 23 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
new file mode 100644
index 0000000000..e97ac199e8
--- /dev/null
+++ b/tests/auto/cmake/test_moc_macro_target/CMakeLists.txt
@@ -0,0 +1,23 @@
+
+cmake_minimum_required(VERSION 2.8)
+
+project(test_moc_macro_target)
+
+find_package(Qt5Core REQUIRED)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+qt5_generate_moc(main_gen_test.cpp
+ "${CMAKE_CURRENT_BINARY_DIR}/main_gen_test.moc"
+ TARGET Qt5GenerateMacroTest
+)
+add_executable(Qt5GenerateMacroTest WIN32 main_gen_test.cpp "${CMAKE_CURRENT_BINARY_DIR}/main_gen_test.moc")
+target_include_directories(Qt5GenerateMacroTest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/interface")
+target_link_libraries(Qt5GenerateMacroTest Qt5::Core)
+
+qt5_wrap_cpp(moc_file mywrapobject.h
+ TARGET Qt5WrapMacroTest
+)
+add_executable(Qt5WrapMacroTest WIN32 main_wrap_test.cpp ${moc_file})
+target_include_directories(Qt5WrapMacroTest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/interface")
+target_link_libraries(Qt5WrapMacroTest Qt5::Core)