-
Notifications
You must be signed in to change notification settings - Fork 979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to tell consumers to use specific generator? #17113
Comments
This is not possible, packages cannot mandate to the consumers what build system should they use. Forcing a generator in consumers is also pointless if their build system won't use it, what problem are you trying to solve? What would be your generator doing? |
My package provides VS build tools. To use it, consumer should use VCVars generator because it calls vcvars.bat from my package which properly sets build environment. Do you have any ideas how I can do this without explicitly listing VCVars generator in all consumers? |
Quick question: The I am afraid there is no direct way to force a consumer to call a generator.
Please try that and let us know. |
Yes, it does this plus some environment tuning through def package_info(self):
self.conf_info.define(
"tools.microsoft.msbuild:installation_path", self.package_folder)
)
I'll give it a try and circle back to you. Meantime, the issue IMHO is pretty straightforward. I'd like to provide a custom command that sets build environment (that basically what VCVars is doing - it adds a call to vcvars.bat). Right now the only way to set build env for consumers is through |
I tried this and was able to add VCVars generator but it doesn't work:
Although I have the following in profile (which is printed by
|
I see there is a check that fails if the path doesn't exist. |
It seems I messed up with CONAN_HOME dir so I re-tested from the scratch and can confirm that hook works. Here is basically the hook I used: def pre_generate(conanfile):
if "vs-buildtools" in conanfile.dependencies.build:
conanfile.output.info("Adding VCVars generator")
conanfile.generators.append("VCVars") @memsharded Thank you for your help. Feel free to close this. |
@memsharded I see something is planned for 2.9 release here. Could you please share what's that? |
It is this PR: #17129 |
What is your question?
I have a package that requires certain generator to be used by consumers to work properly. How can I force consumers to use specific generator in addition to what they use in recipes?
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: