Created attachment 257644 [details] patch Currently ccache doesn't work when USES contains both llvm and cmake. The reason that ccache works without USES=llvm is that CXX=c++ in such case and bsd.ccache.mk adds the directory with ccache-provided c++ into PATH. USES=llvm causes CXX to have the full path to the compiler executable, and the PATH method doesn't work. The attached patch adds ccache to cmake launchers when USES=llvm which fixes ccache in these cases.
Adding kde@ as they maintain cmake and can perhaps chime in too.
ok if ccmake people are ok with it.
(In reply to Yuri Victorovich from comment #0) If the problem is not specific to USES=llvm, shall we enable compiler launcher unconditionally when ccache is used? Is there other need to set CMAKE_C_COMPILER_LAUNCHER? If yes, we should allow user to override it.
(In reply to Max Brazhnikov from comment #3) > If the problem is not specific to USES=llvm, shall we enable compiler launcher unconditionally when ccache is used? ccache only supports C/C++ compilers. C/C++ compilers come from (1) base, (2) llvm, (3) gcc. The case (1) base is already works through the links in /usr/local/libexec/ccache. This patch solves it for (2) llvm. The case (3) gcc is also already works through the links in /usr/local/libexec/ccache. I am not aware of any other C/C++ compilers used on FreeBSD.
(In reply to Max Brazhnikov from comment #3) > Is there other need to set CMAKE_C_COMPILER_LAUNCHER? If yes, we should allow user to override it. This appears to be outside of the scope of the issue that this patch solves.
Committed.
A commit in branch main references this bug: 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(+)