From dfb646b1f06efe3f7b9898e395a7486c483a4c01 Mon Sep 17 00:00:00 2001 From: silverqx Date: Thu, 20 Jun 2024 14:57:24 +0200 Subject: [PATCH] qmake bugfix ccache on MinGW g++ doesn't work still, it reports Preprocessing failed. --- qmake/features/tiny_ccache_win32.prf | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/qmake/features/tiny_ccache_win32.prf b/qmake/features/tiny_ccache_win32.prf index 20c7e6673..b5b046142 100644 --- a/qmake/features/tiny_ccache_win32.prf +++ b/qmake/features/tiny_ccache_win32.prf @@ -1,18 +1,19 @@ -# Target the g++, clang++, msvc, and clang-cl with msvc compilers -!win32|!msvc|mingw: return() +# Target the g++, clang++, MSVC, and Clang-cl with MSVC compilers and also MinGW +if(!win32|!msvc):!mingw: return() # https://github.com/ccache/ccache/issues/1040 -for(cfFlags, \ - $$list(QMAKE_CFLAGS QMAKE_CXXFLAGS \ - QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_DEBUG \ - QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO \ - # The Release build type shouldn't contain this flag but replace it anyway - QMAKE_CFLAGS_RELEASE QMAKE_CXXFLAGS_RELEASE) \ -): \ - !isEmpty($$cfFlags): \ - # Replace -Zi and -ZI with the -Z7 - # The ~= doesn't work with \/ character - $$cfFlags = $$replace($$cfFlags, "(?:-|\/)(?:Zi|ZI)", -Z7) +msvc: \ + for(cfFlags, \ + $$list(QMAKE_CFLAGS QMAKE_CXXFLAGS \ + QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_DEBUG \ + QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO \ + # The Release build type shouldn't contain this flag but replace it anyway + QMAKE_CFLAGS_RELEASE QMAKE_CXXFLAGS_RELEASE) \ + ): \ + !isEmpty($$cfFlags): \ + # Replace -Zi and -ZI with the -Z7 + # The ~= doesn't work with \/ character + $$cfFlags = $$replace($$cfFlags, "(?:-|\/)(?:Zi|ZI)", -Z7) load(private/tiny_ccache_version)