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
passing command line arguments to cmake during conan build #4572
Comments
Have a look here in the docs. def build(self):
cmake = CMake(self)
cmake.definitions["Platform"] = "android"
cmake.configure()
cmake.build()
cmake.install() # Build --target=install |
Please take a look at the example and links provided by @Johnnyxy. That should be the most convenient way to achieve what you are trying to do. If you issue is solved please remember to get it closed. Thanks! 😄 |
I do not know if you can issue arguments directly to any subsequent processes (commandline -> conanfile.py -> process). But you can use conan's options for that. recipeclass recipe(Conanfile)
...
options = {"Platform": None}
...
def build(self):
cmake = CMake(self)
cmake.definitions["Platform"] = self.options.Platform
cmake.configure()
cmake.build()
cmake.install() # Build --target=install commandlineconan create ... --options Platform="android" commentIf you are building for android anyway, you could use the informations conan provides already. def build(self):
cmake = CMake(self)
if (self.settings.os == "Android"):
cmake.definitions["Platform"] = "android"
cmake.configure()
cmake.build()
cmake.install() # Build --target=install |
You could use Conan environment variables for that too, for example: ```$ conan create . user/channel -e PLATFORM=android`` However this will not be takeing into account in the package ID generation as it is created from settings and options. The right approach would be using settings or at least options for that. We have a OS setting in settings.yml file for Andorid operating system as @Johnnyxy pointed out in the comment above. That would be the best way to do it. I am closing this as the answer and approach is clear but feel free to comment or reopen the issue if you find any stopper. Thanks! |
Hi
I'm trying to cross compile my code for android i have to pass an command line argument to cmake like mentioned below
cmake -DPlatform:STRING=android
Is there any way to provide these details during
conan build
command or Is there a way to mention in conanfile.pyThe text was updated successfully, but these errors were encountered: