this post was submitted on 01 Oct 2023
17 points (100.0% liked)

C++

1783 readers
1 users here now

The center for all discussion and news regarding C++.

Rules

founded 1 year ago
MODERATORS
17
CMake Guidelines (developer.mantidproject.org)
submitted 1 year ago by lysdexic to c/cpp
you are viewing a single comment's thread
view the rest of the comments
[–] lysdexic 1 points 1 year ago (1 children)

That explanation apparently it is: “because not everyone in the ecosystem acts the way CMake developers would want them to”, which I read as “CMakes design for external dependencies is broken.”

Not really, it just means you manifest a blatant and critical misunderstanding of what build systems in general do, and in particular what are CMake's responsibilities.

As you're guiding your opinion and expectations on a mental model that's fundamentally broken while being oblivious to the brokenness of the mental model, instead of identifying the real problem you're falling back to blame tools.

The issue is quite simple: CMake is a high-level abstractions which is used to generate arbitrary build systems on arbitrary platforms. No platform provides a standard way to make libraries or modules available. At best, Unix-like OSes store include headers and static and shared libraries in specific locations in the file system, but each library can and often does allow users to customize it's installation. There is no way platform-indendent or platform-specific way to configure these. How do you solve this issue?

CMake solves this issue in a very simple way: library vendors can export CMake config files that downstream dependencies can use to configure their CMake projects. The hard problem becomes a solved problem. However, this requires library vendors to own this leg of the process. Not all projects do. So what can be done about those?

For projects whose managers don't support CMake, CMake provides two mitigations: it ships with CMake-vended config scripts for popular libraries, and allows users to provide their own custom CMake Find modules.

Describing this approach as "broken" is quite honestly a very ignorant and clueless thing to do.

The fact is, where we are right now, today, the find_package/config script design in CMake frequently makes resolving external dependencies far more painful than it already is without that complication.

This personal assertion makes no sense at all and has no basis in reality. The only thing that find_package does is check if someone made available a script that tells CMake how to configure a dependency. If no script was provided, CMake makes the package as not found. If a script was found but it's sanity checks fail then CMake marks the package as not found. If a script is found and it's sanity checks passed, CMake can use the targets in builds. That's all there is to it. Pain-free.

The is only one caveat: you have to have some idea of what you're doing, and bad workmen tend to blame their tools.

[–] [email protected] 1 points 1 year ago

I 've tried to explain what the problem is with CMake's design from the view of someone who has to build a lot of other people's software. Your response just seem to be ad hominem attacks, a reiteration of the underlying problem, and CMake's broken "solution" to it; I don't see much respons to my actual points.

I understand that you feel strongly that the issue of how to locate all those many undeclared, unversioned config files - that for all intents and purposes are hidden build dependencies - is outside CMake's responsibilities. You are allowed that position, but it doesn't change that locating these dependencies is one of the reasons it is significantly more work to build software that uses CMake than other build systems.

A central point of disagreement, I think, is that CMake is designed around the idea that there is a massive value in the meta-abstraction of the build description into something completely platform and environment-independent. It is possible to question how useful this is in general - however - even from the position that this is a great idea, IMO, in practice, CMake largely fails to deliver this meta-abstraction. The builds still tend to only work on systems and in environments on which they have been tested. And, in that case, what is really the benefit of this meta-abstraction over, e.g., "if win64 then ..." "if ubuntu then ..."?