git: f310386faca9 - main - Mk/bsd.ccache.mk: Improve ccache support for ports using cmake

From: Guido Falsi <madpilot_at_FreeBSD.org>
Date: Thu, 18 Sep 2025 17:30:02 UTC
The branch main has been updated by madpilot:

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

commit f310386faca9d21d31a7f358372788e089e250e9
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2025-09-18 17:28:28 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2025-09-18 17:28:28 +0000

    Mk/bsd.ccache.mk: Improve ccache support for ports using cmake
    
    - Make ports cmake macros honor NO_CACHE
    - Make ports cmake macros honor CCACHE_BIN instead of hardcoding the binary name
    
    PR:                     284893
    Reviewed by:            makc
    Approved by:            makc
    Differential Revision:  https://reviews.freebsd.org/D49662
---
 Mk/bsd.ccache.mk | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/Mk/bsd.ccache.mk b/Mk/bsd.ccache.mk
index bf8900430238..ce9b2c7913b6 100644
--- a/Mk/bsd.ccache.mk
+++ b/Mk/bsd.ccache.mk
@@ -103,14 +103,13 @@ ${WRKDIR}/.ccache: ${WRKDIR}
 	@${LN} -sf ${CCACHE_DIR} ${WRKDIR}/.ccache
 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
+.    if defined(_INCLUDE_USES_LLVM_MK) && \
+        defined(_INCLUDE_USES_CMAKE_MK)
+CMAKE_ARGS+=	-DCMAKE_C_COMPILER_LAUNCHER=${CCACHE_BIN} \
+              -DCMAKE_CXX_COMPILER_LAUNCHER=${CCACHE_BIN}
+.    endif
 .  endif
 
 .endif