aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authortcberner <tcberner@FreeBSD.org>2017-12-31 17:43:05 +0800
committertcberner <tcberner@FreeBSD.org>2017-12-31 17:43:05 +0800
commit7d25ef3ca1ec0def652a04b4f1df3ea808aff68d (patch)
treed27a6a4c588a3b8b48bdd20aeba94186a58e56bc /Mk
parentc8ae83175585f53743c92976db19e646502473a0 (diff)
downloadfreebsd-ports-gnome-7d25ef3ca1ec0def652a04b4f1df3ea808aff68d.tar.gz
freebsd-ports-gnome-7d25ef3ca1ec0def652a04b4f1df3ea808aff68d.tar.zst
freebsd-ports-gnome-7d25ef3ca1ec0def652a04b4f1df3ea808aff68d.zip
Add CMAKE_ON and CMAKE_OFF to cmake.mk
USES=cmake now supports two additional list variables: * CMAKE_ON : List of variables to turn on * CMAKE_OFF : List of variables to turn off This can be used as a shortcut to append these to CMAKE_ARGS. For example ports that previously set CMAKE_ARGS= -DVAR1:BOOL=TRUE -DVAR2:BOOL=TRUE -DVAR3:BOOL=FALSE can now set this as CMAKE_ON= VAR1 VAR2 CMAKE_OFF= VAR3 Reviewed by: adridg, rakuco, mat Differential Revision: https://reviews.freebsd.org/D13636
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Uses/cmake.mk9
1 files changed, 9 insertions, 0 deletions
diff --git a/Mk/Uses/cmake.mk b/Mk/Uses/cmake.mk
index 80bf800561f4..057149865f17 100644
--- a/Mk/Uses/cmake.mk
+++ b/Mk/Uses/cmake.mk
@@ -25,6 +25,8 @@
# Default: not set, unless BATCH or PACKAGE_BUILDING is defined
#
# Variables for ports:
+# CMAKE_ON Appends -D<var>:bool=ON to the CMAKE_ARGS,
+# CMAKE_OFF Appends -D<var>:bool=OFF to the CMAKE_ARGS.
# CMAKE_ARGS - Arguments passed to cmake
# Default: see below
# CMAKE_BUILD_TYPE - Type of build (cmake predefined build types).
@@ -89,6 +91,13 @@ CMAKE_ARGS+= -DCMAKE_C_COMPILER:STRING="${CC}" \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=YES \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
+# Handle the option-like CMAKE_ON and CMAKE_OFF lists.
+.for _bool_kind in ON OFF
+. if defined(CMAKE_${_bool_kind})
+CMAKE_ARGS+= ${CMAKE_${_bool_kind}:C/.*/-D&:BOOL=${_bool_kind}/}
+. endif
+.endfor
+
CMAKE_INSTALL_PREFIX?= ${PREFIX}
.if defined(BATCH) || defined(PACKAGE_BUILDING)