diff options
-rw-r--r-- | src/CMakeLists.txt | 14 | ||||
-rw-r--r-- | src/plugins/cppeditor/CMakeLists.txt | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index de0877e9eb..be56ed0bd0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -56,6 +56,12 @@ function(separate_object_libraries libraries REGULAR_LIBS OBJECT_LIBS OBJECT_LIB endif() endfunction(separate_object_libraries) +function(set_explicit_moc target_name file) + set_property(SOURCE "${file}" PROPERTY SKIP_AUTOMOC ON) + qt5_wrap_cpp(file_moc "${file}") + target_sources(${target_name} PRIVATE "${file_moc}") +endfunction() + function(add_qtc_library name) cmake_parse_arguments(_arg "STATIC;OBJECT" "" "DEFINES;DEPENDS;INCLUDES;PUBLIC_DEFINES;PUBLIC_DEPENDS;PUBLIC_INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;PROPERTIES" ${ARGN} @@ -125,9 +131,7 @@ function(add_qtc_library name) endforeach() foreach(file IN LISTS _arg_EXPLICIT_MOC) - set_property(SOURCE ${file} PROPERTY SKIP_AUTOMOC ON) - qt5_wrap_cpp(file_moc ${file}) - target_sources(${name} PRIVATE ${file_moc}) + set_explicit_moc(${name} "${file}") endforeach() foreach(file IN LISTS _arg_SKIP_AUTOMOC) @@ -326,9 +330,7 @@ function(add_qtc_plugin target_name) ) foreach(file IN LISTS _arg_EXPLICIT_MOC) - set_property(SOURCE ${file} PROPERTY SKIP_AUTOMOC ON) - qt5_wrap_cpp(file_moc ${file}) - target_sources(${target_name} PRIVATE ${file_moc}) + set_explicit_moc(${target_name} "${file}") endforeach() install(TARGETS ${target_name} diff --git a/src/plugins/cppeditor/CMakeLists.txt b/src/plugins/cppeditor/CMakeLists.txt index a921291f04..d38a153ce1 100644 --- a/src/plugins/cppeditor/CMakeLists.txt +++ b/src/plugins/cppeditor/CMakeLists.txt @@ -41,4 +41,6 @@ if (WITH_TESTS) fileandtokenactions_test.cpp followsymbol_switchmethoddecldef_test.cpp ) + set_explicit_moc(CppEditor cppdoxygen_test.h) + set_explicit_moc(CppEditor cppquickfix_test.h) endif() |