r/cpp • • Sep 24 '26

Why we should standardise on CPS

To enable any collaboration in the industry, some "social contract" must be signed by all of us.

One of the rules of this contract is binary packaging, to put it simply, if you are a library author you need to either have clean definition on what package you expect to consume or have a "scriptless" implementation like imgui.

If the library exports a pkgconf package, but its dependency exports something else your build will not work. Why should it, what you do makes no sense.

Currently I'm literally forced to package every single dependency I have, which is fine in principle as you want to own your dependencies for security and licensing reasons... But I CAN'T UPSTREAM MY CHANGES which is not fine.

The current situation is a disease, please do remember my talk when you try to build a library like dawn or SDL and it vendors dozens of libraries to create a giant shared library after a long slow build.

0 Upvotes

70 comments sorted by

View all comments

Show parent comment

1

u/not_a_novel_account cmake dev Oct 20 '26

The dark and menacing act of encouraging developers to make the trivial improvements they personally want to see in the open source tools that they use.

1

u/ABlockInTheChain Oct 20 '26

The thing is already know about this limitation and don't need the documentation anymore. If I care about helping future people who will encounter the same difficulties in the future I also know this thread will be indexed by search engines. I don't know how documentation site is built and how one would contribute to it in the first place and if such contributions are even accepted at all.

Furthermore I've discovered that my problem is systemic. I have to deal with a range of packages, some of which use find_package in module mode, and some of which use find_package in config mode, and some which could use either depending on the build environment.

Now that I know that I can't use CPS at all until my entire transitive dependency graph is updated to compatible naming schemes that means I can write this technology off for the rest of my career and stop paying attention to it.

1

u/not_a_novel_account cmake dev Oct 20 '26

if such contributions are even accepted at all.

That's why I said "MRs welcome".

how one would contribute to it

It's just git, the documentation is Sphinx/ReStructured Text. You can write it in plain ASCII:

https://gitlab.kitware.com/cmake/cmake/-/blob/master/Help/command/install.rst?ref_type=heads

Furthermore I've discovered that my problem is systemic.

The best way forward is to open an issue on the tracker and upstream can fix it or clarify if this is even an intended use case: https://gitlab.kitware.com/cmake/cmake/-/work_items

Top right "New Item" button

1

u/ABlockInTheChain Oct 20 '26

"Systemic" means that this problem has to be fixed beyond Kitware.

For CPS to be deployable every project, every Linux distribution, every dependency manager, and CMake itself has to start using CPS-compatible target names exclusively. Is anybody telling them that?

If somebody wants to be able to build my library on a random Ubuntu LTS version which ships system packages in my dependency tree that use incompatible names then my library can not export CPS in that environment. I can't even query whether or not CPS packaging is possible in the current environment so I have to leave CPS exports as an optional feature that defaults to off.

1

u/not_a_novel_account cmake dev Oct 20 '26

For CPS to be deployable every project, every Linux distribution, every dependency manager, and CMake itself has to start using CPS-compatible target names exclusively.

I would not describe this as a near or immediate goal of CPS or the discussion surrounding it in the EcoStd space. It's mostly made to allow various build systems to interoperate within a single managed ecosystem which generates and manages all the package metadata itself (ie Conan).

That aside, there's an ongoing discussion within EcoStd about what the long-term horizon looks like.

I can't even query whether or not CPS packaging is possible in the current environment so I have to leave CPS exports as an optional feature that defaults to off.

If this is something you want to achieve because you're using some feature augmented by CPS (like link-what-you-include), you should open a bug discussing it. You don't have to believe me obviously, but we take them very seriously.

If you just want to use it for early adopter reasons, you should still open the bug. They don't get the same kind of motivated response as "this is breaking production", but they're still appreciated.

1

u/ABlockInTheChain Oct 20 '26

If Kitware was committed to CPS long term, then I think the features I would request are warnings for target names in an install set or created by find_package that are CPS-incompatible.

At least that could plausibly start the very long process of finding all the packages which need to be updated.

1

u/not_a_novel_account cmake dev Oct 20 '26 edited Oct 20 '26

I think what I'm trying to explain is there's a disconnect between what the developers spearheading CPS want to use it for and what you imagine it is for. The only way you bridge that disconnect is by opening issues and joining the discussion.

I don't think many people working on CPS today expect Debian to ship CPS files in the near or mid term, maybe ever. That's not a lack of "commitment", it's not really trying to target that ecosystem. Pkg-Config and Config files already cover there.

"Make Qt packagable with CPS" is itself something that comes up within EcoStd once in awhile, and never found any champions.

1

u/ABlockInTheChain Oct 20 '26 edited Oct 20 '26

I don't think many people working on CPS today expect Debian to ship CPS files in the near or mid term, maybe ever. That's not a lack of "commitment", it's not really trying to target that ecosystem. Pkg-Config and Config files already cover there.

The commitment is advertising that, even if a project doesn't want to use or export CPS, they should at least respect its naming conventions to avoid restricting downstream users who do want to use it. Idiomatic CMake uses CPS-compatible target names.

The problem I immediately ran into when investigating CPS is that my ability to use it is strictly gated by the decisions made by entities outside my control.

If the trend is to start encouraging all these entities to update their naming practices then I can plan on possibly using CPS someday.