pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/devel/cmake



Module Name:    pkgsrc
Committed By:   wiz
Date:           Thu May  1 12:31:45 UTC 2025

Modified Files:
        pkgsrc/devel/cmake: build.mk

Log Message:
cmake: add CMAKE_GENERATORS_INCOMPATIBLE


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 pkgsrc/devel/cmake/build.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/devel/cmake/build.mk
diff -u pkgsrc/devel/cmake/build.mk:1.23 pkgsrc/devel/cmake/build.mk:1.24
--- pkgsrc/devel/cmake/build.mk:1.23    Thu May  1 11:52:26 2025
+++ pkgsrc/devel/cmake/build.mk Thu May  1 12:31:45 2025
@@ -1,4 +1,4 @@
-# $NetBSD: build.mk,v 1.23 2025/05/01 11:52:26 gdt Exp $
+# $NetBSD: build.mk,v 1.24 2025/05/01 12:31:45 wiz Exp $
 #
 # This Makefile fragment supports building using the CMake build tool.
 #
@@ -8,13 +8,6 @@
 # variable CMAKE_GENERATOR must be defined before inclusion (as it is
 # a user-settable variable that should happen automatically).
 #
-# Note that CMAKE_GENERATOR is a user-settable variable, but there is
-# no package-settable CMAKE_GENERATORS_ACCEPTED.  Therefore, when a
-# package fails to build with one of the choices of generators,
-# typically ninja, packages will, as a workaround, set CMAKE_GENERATOR
-# to the one that works, typically make.  (The typical cause is ninja
-# failing with BUILD_DIRS set to a subdirectory.
-#
 # User-settable variables:
 #
 # CMAKE_GENERATOR
@@ -34,6 +27,10 @@
 # CMAKE_INSTALL_ARGS
 #      Arguments to pass to CMake during installation: Default: empty
 #
+# CMAKE_GENERATORS_INCOMPATIBLE
+#      CMAKE_GENERATORS that will not work with this package. (A typical
+#      case is ninja failing with BUILD_DIRS set to a subdirectory.)
+#
 # CONFIGURE_DIR
 #      Directory relative to WRKSRC in which to run CMake. Usually
 #      the top-level one.
@@ -80,16 +77,26 @@ CMAKE_LIBRARY_PATH+=        ${COMPILER_LIB_DIRS
 CONFIGURE_ENV+=                BUILDLINK_DIR=${BUILDLINK_DIR}
 
 CMAKE_BUILD_DIR?=      cmake-pkgsrc-build
-CMAKE_GENERATOR?=      make
 CMAKE_BUILD_ARGS?=     -j ${_MAKE_JOBS_N:U1}
 CMAKE_INSTALL_ARGS?=   -j ${_MAKE_JOBS_N:U1}
-.if ${CMAKE_GENERATOR} == "ninja"
+
+CMAKE_GENERATORS_INCOMPATIBLE?=        # empty
+
+.for cg in ${CMAKE_GENERATOR} make ninja
+.  if empty(CMAKE_GENERATORS_INCOMPATIBLE:M${cg})
+_CMAKE_GENERATOR?=     ${cg}
+.  endif
+.endfor
+_CMAKE_GENERATOR?=     none
+.if ${_CMAKE_GENERATOR} == "ninja"
 TOOL_DEPENDS+=         ninja-build-[0-9]*:../../devel/ninja-build
 _CMAKE_BUILD_SYSTEM?=  Ninja
 _CMAKE_BUILD_TOOL?=    ninja
-.else
+.elif ${_CMAKE_GENERATOR} == "make"
 _CMAKE_BUILD_SYSTEM?=  Unix Makefiles
 _CMAKE_BUILD_TOOL?=    ${MAKE_PROGRAM}
+.else
+PKG_FAIL_REASON+=      "No valid cmake generator found."
 .endif
 
 CONFIGURE_DIR?=                .
@@ -149,8 +156,8 @@ _PKG_VARS.cmake+=   CMAKE_CONFIGURE_ARGS C
 _PKG_VARS.cmake+=      CMAKE_BUILD_ARGS BUILD_DIRS BUILD_TARGET
 _PKG_VARS.cmake+=      TEST_DIRS TEST_TARGET
 _PKG_VARS.cmake+=      CMAKE_INSTALL_ARGS INSTALL_DIRS INSTALL_TARGET
+_PKG_VARS.cmake+=      CMAKE_GENERATORS_INCOMPATIBLE _CMAKE_GENERATOR
 _SYS_VARS.cmake+=      CMAKE_BUILD_DIR
-_USE_VARS.cmake+=      CMAKE_CONFIGURE_ARGS
 _USE_VARS.cmake+=      CONFIGURE_ENV MAKE_ENV TEST_ENV INSTALL_ENV
 _IGN_VARS.cmake+=      BUILDLINK_DIR WRKSRC PREFIX
 _IGN_VARS.cmake+=      BUILD_USES_CMAKE SETENV TOOL_DEPENDS



Home | Main Index | Thread Index | Old Index