conan-io / conan-io/conan

[question] Usefulness of platform_requires

Open
#17,567 5 comments 0 reactions 1 assignee Claimed by @memsharded View on GitHub
type: question
Dominant language
Python
Stars
9.5k
Forks
1.1k
Avg merge
3d 32m
Merged PRs (30d)
18

Description

### What is your question?

I don't understand the `platform_requires` feature or rather what use-cases it was designed for. As far as I understood it just removes the listed requirements from the dependency graph. However, it is not clear to me what problem this is supposed to solve, it rather generates new ones. Most consumers have a `find_package` for the corresponding libraries in their CMakeLists, but as far as I can see, it would not be able to find a library in `CONFIG` mode in the case of a `platform_requires`, as no config file is generated for the library. The standard find module of CMake (if one exists) could possibly find the library in the sysroot in `MODULE` mode, but this is not a universal solution, because there could also be other requirements in the graph that depend on this library. These could not retrieve any meta information about the library at Conan level, as this is not generated anywhere. Also the default find module name in CMake is not guaranteed to be the same as the one used by the corresponding Conan recipes. Even if the consumer does not do `find_package` in CMakeLists, but links directly to the lib file, `platform_requires` is not useful in my opinion, because the CMakeLists would then no longer be Conan-agnostic because you would need two different paths for builds with or without Conan (or maybe with or without `platform_requires`).

### Have you read the CONTRIBUTING guide?

- [X] I've read the CONTRIBUTING guide

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.