diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml
index 74828486b92..41a442753d5 100644
--- a/.github/workflows/clang-tidy.yml
+++ b/.github/workflows/clang-tidy.yml
@@ -53,6 +53,7 @@ jobs:
- name: Prepare CMake dependencies
run: |
# make sure the precompiled headers exist
+ make -C cmake.output/gui cmake_pch.hxx.pch
make -C cmake.output/lib cmake_pch.hxx.pch
make -C cmake.output/test cmake_pch.hxx.pch
# make sure the auto-generated GUI sources exist
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt
index 19953448e9b..e319c35b02f 100644
--- a/gui/CMakeLists.txt
+++ b/gui/CMakeLists.txt
@@ -44,6 +44,9 @@ CheckOptions:
else()
target_include_directories(cppcheck-gui SYSTEM PRIVATE ${tinyxml2_INCLUDE_DIRS})
endif()
+ if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)
+ target_precompile_headers(cppcheck-gui PRIVATE precompiled.h)
+ endif()
if (HAVE_RULES)
target_link_libraries(cppcheck-gui ${PCRE_LIBRARY})
endif()
diff --git a/gui/precompiled.h b/gui/precompiled.h
new file mode 100644
index 00000000000..c21895879d3
--- /dev/null
+++ b/gui/precompiled.h
@@ -0,0 +1,31 @@
+/*
+ * Cppcheck - A tool for static C/C++ code analysis
+ * Copyright (C) 2007-2023 Cppcheck team.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+
+#include "checkthread.h"
+#include "codeeditor.h"
+#include "codeeditorstyle.h"
+#include "config.h"
+#include "cppcheck.h"
+#include "cppchecklibrarydata.h"
+#include "report.h"
+#include "showtypes.h"
+
+#include
+#include
diff --git a/lib/precompiled.h b/lib/precompiled.h
index d1b222012e4..1a2c9dd84f1 100644
--- a/lib/precompiled.h
+++ b/lib/precompiled.h
@@ -17,11 +17,13 @@
*/
#pragma once
-#include "config.h"
-#include "check.h"
+#include "astutils.h"
+#include "errorlogger.h"
#include "library.h"
+//#include "matchcompiler.h"
+#include "mathlib.h"
#include "token.h"
-#include "tokenize.h"
-#include "valueflow.h"
-#include "symboldatabase.h"
#include "settings.h"
+#include "suppressions.h"
+#include "utils.h"
+#include "valueflow.h"
diff --git a/test/fixture.h b/test/fixture.h
index 23d7b43e327..5fb3b0eee44 100644
--- a/test/fixture.h
+++ b/test/fixture.h
@@ -135,7 +135,10 @@ class TestFixture : public ErrorLogger {
static std::size_t runTests(const options& args);
};
+// TODO: fix these
+// NOLINTNEXTLINE(readability-redundant-declaration)
extern std::ostringstream errout;
+// NOLINTNEXTLINE(readability-redundant-declaration)
extern std::ostringstream output;
#define TEST_CASE( NAME ) do { if (prepareTest(#NAME)) { setVerbose(false); NAME(); } } while (false)
diff --git a/test/precompiled.h b/test/precompiled.h
index fe0ae9a2fb0..1da2e84cdd7 100644
--- a/test/precompiled.h
+++ b/test/precompiled.h
@@ -17,8 +17,14 @@
*/
#pragma once
-#include "fixture.h"
+
+#include "check.h"
+#include "config.h"
+#include "importproject.h"
+#include "library.h"
+#include "mathlib.h"
#include "settings.h"
+#include "timer.h"
+#include "token.h"
+#include "tokenlist.h"
#include "tokenize.h"
-#include "library.h"
-#include "check.h"