diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e1acdd627e..7f3cd60b14f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1094,6 +1094,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/util/logger.cpp src/util/logging.cpp src/util/mac.cpp + src/util/moc_included_test.cpp src/util/movinginterquartilemean.cpp src/util/performancetimer.cpp src/util/rangelist.cpp @@ -1476,6 +1477,8 @@ else() endif() endif() +set_source_files_properties(src/util/moc_included_test.cpp PROPERTIES SKIP_PRECOMPILE_HEADERS ON) + set_target_properties(mixxx-lib PROPERTIES AUTOMOC ON AUTOUIC ON CXX_CLANG_TIDY "${CLANG_TIDY}") target_include_directories(mixxx-lib PUBLIC src "${CMAKE_CURRENT_BINARY_DIR}/src") if(UNIX AND NOT APPLE) @@ -2092,6 +2095,7 @@ add_executable(mixxx-test src/test/wbatterytest.cpp src/test/wpushbutton_test.cpp src/test/wwidgetstack_test.cpp + src/util/moc_included_test.cpp ) find_package(GTest CONFIG REQUIRED) set_target_properties(mixxx-test PROPERTIES AUTOMOC ON) diff --git a/src/test/ringdelaybuffer_test.cpp b/src/test/ringdelaybuffer_test.cpp index 8cbb80bfc56..9f3f5a788b1 100644 --- a/src/test/ringdelaybuffer_test.cpp +++ b/src/test/ringdelaybuffer_test.cpp @@ -6,7 +6,6 @@ #include #include -#include #include "test/mixxxtest.h" #include "util/samplebuffer.h" diff --git a/src/util/moc_included_test.cpp b/src/util/moc_included_test.cpp new file mode 100644 index 00000000000..605693a25e5 --- /dev/null +++ b/src/util/moc_included_test.cpp @@ -0,0 +1,8 @@ +#include "../mocs_compilation.cpp" + +// QT_VERSION will be defined by any moc_.cpp file included from mocs_compilation.cpp +// It is empty in case all moc files are included, a requirement to speed up incremental builds. +// See https://cmake.org/cmake/help/latest/prop_tgt/AUTOMOC.html for details. +#ifdef QT_VERSION +#error mocs_compilation.cpp not empty. Move all #include "moc_.cpp" lines from mocs_compilation.cpp to the cpp files of the related classes. +#endif diff --git a/src/util/ringdelaybuffer.cpp b/src/util/ringdelaybuffer.cpp index 3915c97b4ea..1981647c6c5 100644 --- a/src/util/ringdelaybuffer.cpp +++ b/src/util/ringdelaybuffer.cpp @@ -1,7 +1,5 @@ #include "ringdelaybuffer.h" -#include - #include "util/math.h" #include "util/sample.h"