Tuesday, May 20, 2025

Re: required c++ language standard

>Hi Greg,

better a brief reply than a late one:

On 5/19/25 5:09 PM, Greg Troxel wrote:
> It would be nice to have something easily found by a human,

agreed, but on the scale of "someone needs to know about this" and "it would be bad if
documentation goes out of sync with the implementation", setting the C++17 standard is
something that can really be left up to code.

The problem only arises if you **externally** try to force a C++ standard. If you don't do
that, then it just works. And you'll have a hard time finding a pre-C++17 compiler,
anyways, on a modern Linux.

So, I hope you understand that this is kind of low priority.

> When packaging, I like
> to align the package config files to the upstream documented
> requirements, rather than fiddling until it builds, to make it more
> likely it will be ok on some other system.

Then simply don't try to externally set C++ standard. A C++ CMake project that needs
anything newer than C++03 typically sets that itself.

> In theory I know that, but I couldn't find it in the cmake output.
> (It's also a general bug of cmake to hide build lines by default :-(
> which makes this harder.)

Seriously, I'm afraid this is a target-specific problem :) again, if you don't try to
force your compiler settings on a project in a nonstandard way, it'll just work :)

> How does building gr-osmosdr work? I don't see that it requires C++17
> (because it's in C++11 itself), but if the compiler isn't in C++17 mode
> it will object to gnuradio's headers.

CMake. When you declare a dependency on another CMake project, that imports the compiler
capabilities needed by the dependency when applicable. This all just works.

> So I think I need to in our "buildlink" file (that you include when you
> want to link against stomething) for GNU Radio add a setting to force
> c++17 mode.

That sounds like a reinvention of CMake config files and those are already a reinvention
of pkg-config .pc files – both of which GNU Radio exports, because they are well-supported
standards!
Does pkgsrc not support any of these standard mechanism?

> My cmake output follows, and I don't see about testing if the compiler
supports C++17.

I'm afraid GNU Radio is in no way different to any of the tens of thousand other
CMake-using projects out there; you'll have to deal with that as packager!

Best regards,
Marcus

No comments:

Post a Comment