git: 07ebebf97e7c - main - USES=cmake: be explicit about incompatibilities with ninja

From: Adriaan de Groot <adridg_at_FreeBSD.org>
Date: Thu, 05 May 2022 22:45:36 UTC
The branch main has been updated by adridg:

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

commit 07ebebf97e7cc575bc90b37f5d46097179201285
Author:     Adriaan de Groot <adridg@FreeBSD.org>
AuthorDate: 2022-05-05 22:23:35 +0000
Commit:     Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2022-05-05 22:45:34 +0000

    USES=cmake: be explicit about incompatibilities with ninja
    
    Document how `USES=gmake` and `USES=emacs` are incompatible with
    the default `USES=cmake` behavior of using ninja as generator.
    Using a naive `USES=cmake emacs` line used to get you a strange
    ninja error when ${MAKE_ARGS} is passed to it, now there is a
    meaningful error message beforehand.
    
    The linked PR examines ways to make it "just work", but that
    got bogged down. Do a partial fix so it is easier to track
    down next time.
    
    PR:             251191
---
 Mk/Uses/cmake.mk | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Mk/Uses/cmake.mk b/Mk/Uses/cmake.mk
index a4c1edd3f0b2..eeaa2fda20f7 100644
--- a/Mk/Uses/cmake.mk
+++ b/Mk/Uses/cmake.mk
@@ -127,8 +127,15 @@ TEST_WRKSRC?=		${CONFIGURE_WRKSRC}
 #             as the build.ninja file won't be where ninja expects it.
 .  if empty(cmake_ARGS:Mnoninja) && empty(cmake_ARGS:Mrun) && empty(USES:Mfortran)
 .    if "${CONFIGURE_WRKSRC}" == "${BUILD_WRKSRC}" && "${CONFIGURE_WRKSRC}" == "${INSTALL_WRKSRC}"
+# USES=gmake sets MAKE_CMD and ninja.mk does too (it also messes with MAKEFILE and MAKE_CMD).
 .      if ! empty(USES:Mgmake)
-BROKEN=		USES=gmake is incompatible with cmake's ninja-generator
+BROKEN=		USES=gmake is incompatible with cmake's ninja-generator (try cmake:noninja)
+.      endif
+# USES=emacs appends EMACS=<path> to MAKE_ARGS, which then get passed to ninja.
+# Since ninja doesn't support that kind of variable-setting on the command-line,
+# it errors out.
+.      if ! empty(USES:Memacs)
+BROKEN=		USES=emacs is incompatible with cmake's ninja-generator (try cmake:noninja)
 .      endif
 .      include "${USESDIR}/ninja.mk"
 .    endif