Index: head/CHANGES =================================================================== --- head/CHANGES +++ head/CHANGES @@ -10,6 +10,20 @@ All ports committers are allowed to commit to this file. +20171231: +AUTHOR: kde@FreeBSD.org + + 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 + 20171130: AUTHOR: mat@FreeBSD.org Index: head/Mk/Uses/cmake.mk =================================================================== --- head/Mk/Uses/cmake.mk +++ head/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:bool=ON to the CMAKE_ARGS, +# CMAKE_OFF Appends -D: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). @@ -88,6 +90,13 @@ -DTHREADS_HAVE_PTHREAD_ARG:BOOL=YES \ -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}