[Bug 290582] Mk/bsd.options.mk: Update *_CMAKE_BOOL and *_CMAKE_BOOL_OFF

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Oct 31 08:14:04 GMT 2025


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=290582

Jason E. Hale <jhale at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|maintainer-feedback?        |maintainer-feedback+
                 CC|                            |jhale at FreeBSD.org
             Status|New                         |Open

--- Comment #4 from Jason E. Hale <jhale at FreeBSD.org> ---
CMake supports several boolean values as equivalent (e.g. 0/OFF/FALSE/NO vs.
1/ON/TRUE/YES, respectively) and I really don't see how this fixes anything.

As pointed out by makc, it is confusing. And if it's confusing for veterans
like him or myself, newcomers probably aren't going to fare any better.
CMAKE_ON/OFF as defined by Mk/Uses/cmake.mk means something totally different
than ${opt}_CMAKE_ON/OFF as defined in Mk/bsd.options.mk. In a Makefile,
${CMAKE_ON} acts like ${opt)_CMAKE_BOOL, but ${opt)_CMAKE_ON acts like
${CMAKE_ARGS}:

<Mk/Uses/cmake.mk>
CMAKE_ON=foo -> CMAKE_ARGS+=-Dfoo:BOOL:ON
CMAKE_OFF=foo -> CMAKE_ARGS+=-Dfoo:BOOL:OFF
<Mk/bsd.options.mk>
BAR_CMAKE_ON=-Dfoo -> CMAKE_ARGS+=-Dfoo
BAR_CMAKE_OFF=-Dfoo -> CMAKE_ARGS+=-Dfoo
BAR_CMAKE_BOOL=foo -> CMAKE_ARGS+=-Dfoo:BOOL=true
BAR_CMAKE_BOOL_OFF=foo -> CMAKE_ARGS+=-Dfoo:BOOL=false

Super easy to comprehend. /s

I suppose we could blame this on 13 year old design decisions like
${opt}_CONFIGURE_ON/OFF as shorthand for ${opt)_CONFIGURE_ARGS_ON/OFF [1] which
has propagated to CMake, qmake, and meson. ${opt}_CMAKE_BOOL vs.
${opt}_CMAKE_BOOL_OFF is especially strange in the status quo, though.
${opt)_CMAKE_BOOL_ON would make much more sense as the counterpart to
${opt)_CMAKE_BOOL_OFF, IMHO.

I think it would be more clear to distinguish ports options ON/OFF boolean
values from build system boolean values in bsd.options.mk. E.g, I think
${opt)_CONFIGURE_ON/OFF should be ${opt}_CONFIGURE_ARGS_ON/OFF,
${opt)_CMAKE_ON/OFF should be ${opt}_CMAKE_ARGS_ON/OFF, etc.
${opt}_CMAKE_BOOL[_OFF] could become ${opt}_CMAKE_TRUE/FALSE and CMAKE_ON/OFF
in cmake.mk would become CMAKE_TRUE/FALSE.

So, as a concept, and just for just CMake, I think this is more intuitive:
<Mk/Uses/cmake.mk>
CMAKE_TRUE=foo -> CMAKE_ARGS+=-Dfoo:BOOL:TRUE
CMAKE_FALSE=foo -> CMAKE_ARGS+=-Dfoo:BOOL:FALSE
<Mk/bsd.options.mk>
BAR_CMAKE_ARGS_ON=-Dfoo -> CMAKE_ARGS+=-Dfoo
BAR_CMAKE_ARGS_OFF=-Dfoo -> CMAKE_ARGS+=-Dfoo
BAR_CMAKE_TRUE=foo -> CMAKE_ARGS+=-Dfoo:BOOL=TRUE
BAR_CMAKE_FALSE=foo -> CMAKE_ARGS+=-Dfoo:BOOL=FALSE

[1]
https://cgit.freebsd.org/ports/commit/Mk/bsd.options.mk?id=67cfdf9034f9ee7b936adaf1be0cc08a4e538f60

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the kde-freebsd mailing list