From 8074693425e06d2c4a8f130124658fe72f3e5ab9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 19 Jun 2013 17:56:04 +0200 Subject: 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 --- .../cmake/test_moc_macro_target/CMakeLists.txt | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/auto/cmake/test_moc_macro_target/CMakeLists.txt (limited to 'tests/auto/cmake/test_moc_macro_target/CMakeLists.txt') 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) -- cgit v1.2.3