Hi David, * David Kalnischkies <da...@kalnischkies.de> [2023-06-17 13:23]:
fwiw apt would trigger this in its autopkgtest as one of them (the main run-tests) builds a sub-directory of helpers with cmake via the main "upstream" CMakeList.txt file. That test is allowed to have stderr output through, so no problem on that front. I just report this back as I think its a bit optimistic to assume everything building something in tests would do so from within debian/tests. I would actually hope most would build some part of upstream like apt instead… just saying.
That is true, but I could not think of a simple way to detect that from source code only. Looking for all cmake_minimum_required() created *a lot* of false positives, where the warning will only show up in the buildd log and do no harm otherwise.
(I doubt there is any reason apt uses that particular version, but my cmake knowledge is on a pure edit-semi-randomly-until-it-seems-to- work-as-wanted basis)
You are not the only one, not by a long shot. :) <Rant> Being backwards compatible is CMake's greatest blessing and greatest curse at the same time, because people still run into crappy, 20 year old tutorials and needlessly complicated (but working) code snippets from CMake 2.x on the Internet, making them believe that CMake is crappy and needlessly complicated. It is better than its reputation. It does lack good, recent tutorials though. </Rant>
Can you recommend a relatively safe & old version to use instead of < 3.5 which doesn't need bumping next month but is also available in most semi-current releases of all major distributions (as that is what most upstreams will care about if they don't have special needs)?
The *correct* minimum version is actually not that easy to determine, because CMake, for some reason, will let you say "cmake_minimum_required(VERSION 3.0)" and still use newer commands such as "add_link_options" (introduced in CMake 3.13) without warning. Speaking of 3.13, Buster aka oldoldstable ships with CMake 3.13 (released in 2018) and Repology tells me that any relevant distribution with an older CMake is either completely unsupported or you need to buy LTS for it. That sounds like a reasonable support baseline to me. More elegant is a version range: if your script does not give any policy warnings with a recent CMake (say CMake 3.26), you can write something like "cmake_minimum_required(VERSION 3.0...3.26)", which will continue to work with old CMake releases but not trigger any support warnings for the forseeable future, because only the upper bound is considered for that. Cheers Timo -- ⢀⣴⠾⠻⢶⣦⠀ ╭────────────────────────────────────────────────────╮ ⣾⠁⢠⠒⠀⣿⡁ │ Timo Röhling │ ⢿⡄⠘⠷⠚⠋⠀ │ 9B03 EBB9 8300 DF97 C2B1 23BF CC8C 6BDD 1403 F4CA │ ⠈⠳⣄⠀⠀⠀⠀ ╰────────────────────────────────────────────────────╯
signature.asc
Description: PGP signature