[Bug 280396] Mk/Uses/cmake.mk: Disallow USE_CSTD and USE_CXXSTD

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Jul 22 10:17:36 BST 2024


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jhale at FreeBSD.org

--- Comment #4 from Jason E. Hale <jhale at FreeBSD.org> ---
Created attachment 252220
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=252220&action=edit
POC: Convert USE_C*STD to CMake native

In concept, I think this a good idea, but I'm not sold on the execution. For
example, your "BROKEN" message is not in the correct place, because it won't
apply to any ports that have fortran, noninja or run as arguments passed to
USES=cmake. The run argument isn't important in this case, though.

Now, I'd be more of a buyer if the "BROKEN=" message were converted to a
"WARNING+=" or "DEV_WARNING+=" message since while having conflicting -std=*
arguments passed to the compiler isn't exactly ideal, I don't think that
warrants automatically marking a port as BROKEN when it has presumably been
building just fine prior to this change. Automatically marking ports BROKEN
just because they don't strictly conform to a fabricated ideal is, quite
frankly, absurd. As a side note: The *WARNING variables, unlike the BROKEN
variable, require their contents to be double quoted and very much do not like
their contents to contain parentheses (or round brackets if you're a weirdo
j/k)...anyways, these things -> ().

Now that I'm thinking...instead of marking everything BROKEN, painstakingly
iterating through the entire ports tree pounding on countless individual ports
to make them submit, banishing use of standard bsd.port.mk variables, or
potentially adding WARNINGs that could make use of CMake seem even more
off-putting than it already is to some, let's take a breather. Refocus. Perhaps
we could be a bit more clever and handle this transparently entirely within the
CMake framework.

The pseudocode I'm currently thinking about in cmake.mk is this:
- Check if USE_C*STD is defined
- If so, save the contents of USE_C*STD to a "private" temporary variable
- Undefine USE_C*STD, so that it isn't used in bsd.port.mk
- Determine the standard and if extensions are needed from that "private"
variable
- Pass above information to the appropriate CMake variables

I've attached an almost not tested proof of concept that doesn't include any
error checking, but bsd.port.mk doesn't either with regard to the USE_C*STD
variables. For example, if one defines USE_CXXSTD=c++42069 in a port Makefile,
that will simply be added to CXXFLAGS with a "-std=" slapped in front of it.
Port maintainers and especially committers are expected to know better.
Defining this wouldn't pass the configure stage, anyways, at least with CMake.

I don't believe my POC would require other changes in the ports tree. To me,
this would be much less intrusive and the idea of not being able to use
standard bsd.port.mk variables in ports that use CMake just really puts a bad
taste in my mouth.

Open for feedback.

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


More information about the kde-freebsd mailing list