4.4.0: CMake Error: The warning category "all" is not known.

Hi!

After updating CMake in pkgsrc to 4.4.0, dynamips started failing with an error I don’t understand:

-- Looking for clock_gettime in rt
CMake Error: The warning category "all" is not known.
CMake Error at /opt/pkg/share/cmake-4.4/Modules/CheckLibraryExists.cmake:154 (try_compile):
  Failed to configure test project build system.
Call Stack (most recent call first):
  cmake/dependencies.cmake:113 (check_library_exists)
  CMakeLists.txt:32 (include)

pkgsrc is one version (0.2.23) behind the latest (0.2.24) but it fails the same way in 0.2.24

Can someone please explain the problem and suggest a solution?

Thanks,
Thomas

This is a bug. Please open an issue on the tracker.

Thanks for the feedback - I’ve just done that:

https://gitlab.kitware.com/cmake/cmake/-/work_items/27961

In case anyone else stumbles across this… The underlying issue, and the reason you get such an apparently obtuse error, is that you are using CMAKE_REQUIRED_FLAGS wrong. Specifically, because you’re passing a semicolon (;) separated list rather than a space ( ) separated list — probably because you forgot to quote something that should have been quoted — you are passing stuff meant to be compile options as arguments to the nested CMake invocation. This results in a somewhat obtuse error, because you aren’t expecting errors related to misuse of CMake’s CLI to be emitted from a try_compile. (Nor should you; it’s a bug that these arguments can “leak” in the first place, but unfortunately one that runs into Hyrum’s Law.)

It just so happens that if these spurious flags were compiler warnings, CMake < 4.4 silently ignored whatever -W<garbage> it saw. We’re working on tweaking affected modules so your old builds will continue to work (and filing a bug against CMake is a correct action), but in the mean time, you should (also) fix your own code. :slightly_smiling_face: (If for no other reason that it isn’t doing what you almost certainly meant for it to be doing.)

See also https://gitlab.kitware.com/cmake/cmake/-/work_items/27901.

I expect that we’ll eventually fix things so as to ensure that all of CMAKE_REQUIRED_FLAGS is handled as compile options, regardless of how you separate those options.