Created attachment 171795 [details] opt_CMAKE_BOOL Many ports that use cmake have to enable or disable boolean features. ex.: [adamw@apnoea ~] grep BOOL /usr/ports/audio/libsoxr/Makefile CMAKE_MAKE_ARGS+= -DWITH_LSR_BINDINGS:BOOL=ON \ -DBUILD_SHARED_LIBS:BOOL=ON OPENMP_CMAKE_ON= -DWITH_OPENMP:BOOL=ON OPENMP_CMAKE_OFF= -DWITH_OPENMP:BOOL=OFF SIMD_CMAKE_OFF= -DWITH_CR32S:BOOL=OFF \ -DWITH_CR64S:BOOL=OFF AVFFT_CMAKE_ON= -DWITH_AVFFT:BOOL=ON AVFFT_CMAKE_OFF= -DWITH_AVFFT:BOOL=OFF PFFFT_CMAKE_ON= -DWITH_PFFFT:BOOL=ON PFFFT_CMAKE_OFF= -DWITH_PFFFT:BOOL=OFF By my count, there are about 225 ports that use this construct. The attached patch adds a opt_CMAKE_BOOL helper. It makes the above be: OPENMP_CMAKE_BOOL= OPENMP AVFFT_CMAKE_BOOL= WITH_AVFFT PFFFT_CMAKE_BOOL= PFFFT It only saves one line at a time, but it saves a lot of typing.
Typoed the example there. Of course it's: OPENMP_CMAKE_BOOL= WITH_OPENMP etc.
Would be nice if: FOO_CMAKE_BOOL= FOO BAR worked ;-)
(and not with a for loop)
Created attachment 171799 [details] No fors Okay. Here's a patch which handles multiple words, and doesn't have a for loop.
If it works with make and fmake (on 9) feel free to commit it.
A commit references this bug: Author: adamw Date: Sat Jun 25 22:23:37 UTC 2016 New revision: 417497 URL: https://svnweb.freebsd.org/changeset/ports/417497 Log: Add an opt_CMAKE_BOOL options helper. SOMEOPT_CMAKE_BOOL= WITH_FOO BAR expands to: -DWITH_FOO:BOOL=true -DBAR:BOOL=true or -DWITH_FOO:BOOL=false -DBAR:BOOL=false PR: 210576 Approved by: portmgr (mat) Changes: head/CHANGES head/Mk/bsd.options.mk
Committed. Thanks for such a quick review, mat!
Oh, could you also add a CMAKE_BOOL_OFF that does the opposite, like all other options helpers have ?
I'm documenting it in http://aragorn.in.absolight.net/d2/cmake_bool/en_US.ISO8859-1/books/porters-handbook/makefile-options.html#options-cmake_bool
A commit references this bug: Author: mat Date: Sun Jun 26 16:23:37 UTC 2016 New revision: 417532 URL: https://svnweb.freebsd.org/changeset/ports/417532 Log: Add opt_CMAKE_BOOL_OFF, oposite of opt_CMAKE_BOOL. PR: 210576 Sponsored by: Absolight Changes: head/Mk/bsd.options.mk
A commit references this bug: Author: mat Date: Tue Jun 28 08:08:41 UTC 2016 New revision: 49014 URL: https://svnweb.freebsd.org/changeset/doc/49014 Log: Document opt_CMAKE_BOOL and opt_CMAKE_BOOL_OFF. PR: 210576 Reviewed by: wblock Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D6970 Changes: head/en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml