this post was submitted on 01 Oct 2023
17 points (100.0% liked)
C++
1773 readers
5 users here now
The center for all discussion and news regarding C++.
Rules
- Respect instance rules.
- Don't be a jerk.
- Please keep all posts related to C++.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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.
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.