Comments (3)
Hi @s-mlr
Thanks for your question.
Have you considered using the cppinfo.resdirs
definition? (https://docs.conan.io/2/reference/conanfile/methods/package_info.html). This would be intended for directories containing resource files for consumers.
Then, the only issue is that there is no standard way to use these files in the consumers. CMakeToolchain
will have the <pkgname>_RES_DIRS_<config>
variables defines, you might want to directly use these variables in your consumer CMakeLists.txt
after the find_package
?
If not, it is possible to directly access from the consumers:
# in the consumer conanfile.py
def generate(self):
res_folder = self.dependencies["mydep"].cpp_info.resdirs
# do whatever operation you need to do with the ``res_folder`` or the files inside it
Note this doesn't really hardcode the path to the files in the dependency, the resdirs
is an abstraction/parameterization, and can be used to change it in the dependency without altering the consumer.
Please let me know if this helps.
from conan.
Thanks @memsharded for your immediate reply. Your response times are second to none!
That approach certainly works and I'm completely fine with. I mainly wanted to make sure there is no other design available to completely take care of this from the consumer side. As long as I'm following best practices it's all good.
It does feel like it would be aligned with the general idea / behavior of current generators (as I read them) to fully define it from consumer side and the tc basically already added that option, so I'm keen to see if something along those lines might be coming in the future?
Please consider the question answered. Thanks a bunch!
from conan.
It does feel like it would be aligned with the general idea / behavior of current generators (as I read them) to fully define it from consumer side and the tc basically already added that option, so I'm keen to see if something along those lines might be coming in the future?
The challenge here is that we haven't seen any common pattern or usage of resource files, that are wildly varying in nature and usage. For a built-in generator it would be necessary to have some well known and popular usage patterns to implement anything in Conan. As always, we are open to feedback to learn about the use cases, but so far seems a bit unlikely.
Thanks to you for the feedback!
from conan.
Related Issues (20)
- [question] Is IMPORTED_LOCATION missing for conan_package_library_targets? HOT 4
- [bug] yasm/1.3.0 doesn't compile with MSVC in release HOT 4
- [question] How to support conanfile.py in a subdirectory, using Bazel HOT 2
- [bug] generated BUILD.bazel file does not import dll when shared=True for some packages
- [question] Access Resource file in cmake module HOT 2
- [bug] Conan install/graph explain don't find package because they don't filter based on settings/options before selecting package candidate HOT 1
- [question] Header library automatic downstream header propagation HOT 4
- [bug] `conan.tools.files.copy()` fails silently. HOT 3
- [question] tool_requires ignores option settings? HOT 5
- [question] Propagating bin dirs for hybrid package HOT 7
- [suggestion] Allow specifying commit hash when installing config from git repository with `conan config install` HOT 3
- [bug] `self.source_folder` varies whether building with `conan create .` or `conan build .`. HOT 2
- [question] Artifactory compatibility between Conan 1 and Conan 2? HOT 6
- [question] alternative solution to Conan 1 alias? HOT 4
- Server side atomic uploads for concurrent uploads
- [question] compatibility strategy for Conan 1 between "Visual Studio" and "msvc"? HOT 3
- [question] How to properly capture SCM in complex scenarios? HOT 1
- [bug] __pycache__ presence violates cached package integrity HOT 10
- [feature] Manifold workspace HOT 6
- [question] Best practices to use Conan in large projects HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conan.