git: 56538adacf53 - main - Mk/bsd.ccache.mk: Fix ccache for ports that have USES=llvm and USES=cmake

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sun, 23 Mar 2025 07:56:19 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=56538adacf53391307f687155be3fc787a95f40b

commit 56538adacf53391307f687155be3fc787a95f40b
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2025-03-23 05:09:17 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2025-03-23 07:56:12 +0000

    Mk/bsd.ccache.mk: Fix ccache for ports that have USES=llvm and USES=cmake
    
    PR:             284893
    Approved by:    Rene Ladan <rene@FreeBSD.org> (on behalf of portmgr@)
---
 Mk/bsd.ccache.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Mk/bsd.ccache.mk b/Mk/bsd.ccache.mk
index 83f225748420..bf8900430238 100644
--- a/Mk/bsd.ccache.mk
+++ b/Mk/bsd.ccache.mk
@@ -105,4 +105,12 @@ ccache-wrkdir-link: ${WRKDIR}/.ccache .PHONY
 post-extract: ccache-wrkdir-link
 .  endif
 
+# enable ccache in case of USES=llvm and cmake
+.  if ${CCACHE_ENABLED} == yes && \
+      defined(_INCLUDE_USES_LLVM_MK) && \
+      defined(_INCLUDE_USES_CMAKE_MK)
+CMAKE_ARGS+=	-DCMAKE_C_COMPILER_LAUNCHER=ccache \
+				-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
+.  endif
+
 .endif