You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the CMake files do not create a target for the protozero library itself.
CMake supports so called interface targets, which are targets which contain only header files but do not build anything.
So instead of making the includes available everywhere, an application that wants to use protozero can link against that target.
(The canonical way would be to call it protozero::protozero).
Would you accept a PR that makes the required changes?
It would then allow to use protozero as via add_subdirectory, or via find_package(protozero REQUIRED), but instead of manually providing a FindProtozero.cmake file, it would generate a protozere-config.cmake file upon install.
Protozero has been around since before CMake introduced that capability/syntax and is used by software using the "old" approach that we currently have. I'd be all for changing that but we need to do it in a backwards compatible way. If you know how to do that, I think we'd be willing to consider a PR.
@joto we have VERSION 3.10.0 in our CMake file already, primarily because CMake 4 errors when the version in a CMake file is too old, so I’m not sure that we necessarily need to worry about versions of CMake that don’t support this syntax. If you truly need to use an archaic version of CMake, you can always resort to just adding the protozero include directory to your target, since there’s no complex build step involved for Protozero anyway, and a CMake target would mostly be a convenience feature.
I think I can find a way to make it compatible, probably using some kind of option.
We can always define the targets, but opt out of include_directories.
Which CMake version would be ok as a minimum? 3.23 provides file sets, which makes it even easier to install the headers, but something older would also work.
Debian Bullseye is still supported and probably used by some and it has CMake 3.18.4., Ubuntu 22.04 has CMake 3.22.1. I think we don't need go farther back then these, but would be good to keep support for them.
Debian Bullseye is EOL, the oldest thing we would want to support is now Ubuntu 22.04 which has CMake 3.22.1
There really is nothing in Protozero that needs fancy configuration, all we need really is the path to the include file, so the question is whether we need all of this at all. What the current script provides beyond that is just the version check.
We probably can just have two versions of this script side by side. We can keep the old one for users of the "old way of doing things" and provide a new one for the rest. The script has to be copied into the project using it anyway. I should have thought about this earlier, sorry. So if anybody wants to provide a PR for the more modern CMake, please to so, keeping the old stuff in place.
Activity
joto commentedon Oct 10, 2025
Protozero has been around since before CMake introduced that capability/syntax and is used by software using the "old" approach that we currently have. I'd be all for changing that but we need to do it in a backwards compatible way. If you know how to do that, I think we'd be willing to consider a PR.
kkaefer commentedon Oct 16, 2025
@joto we have
VERSION 3.10.0in our CMake file already, primarily because CMake 4 errors when the version in a CMake file is too old, so I’m not sure that we necessarily need to worry about versions of CMake that don’t support this syntax. If you truly need to use an archaic version of CMake, you can always resort to just adding the protozero include directory to your target, since there’s no complex build step involved for Protozero anyway, and a CMake target would mostly be a convenience feature.joto commentedon Oct 16, 2025
@kkaefer I am not worried about old CMake versions, I am worried about old users of protozero who use the old way of things in their CMake configs.
KerstinKeller commentedon Oct 17, 2025
I think I can find a way to make it compatible, probably using some kind of option.
We can always define the targets, but opt out of
include_directories.Which CMake version would be ok as a minimum? 3.23 provides file sets, which makes it even easier to install the headers, but something older would also work.
joto commentedon Oct 17, 2025
Debian Bullseye is still supported and probably used by some and it has CMake 3.18.4., Ubuntu 22.04 has CMake 3.22.1. I think we don't need go farther back then these, but would be good to keep support for them.
joto commentedon Oct 15, 2026
Taking a look at this again: