• lysdexic@programming.devOPM
    link
    fedilink
    English
    arrow-up
    1
    ·
    11 months ago

    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.