-
Notifications
You must be signed in to change notification settings - Fork 254
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
[bug] conanfile.txt and conanfile.py behave inconsistently #662
Comments
I'm not sure if this is an issue here or in https://github.com/conan-io/cmake-conan, happy to create another one over there. |
Hi @pschichtel, Thanks for the question. I think that the problem could be that you need to add the Please try with something like this: from conan import ConanFile
class LibDataChannel(ConanFile):
settings = "os", "arch", "compiler", "build_type"
requires = "openssl/3.2.2"
generators = "CMakeDeps"
def configure(self):
# self.options["openssl"].shared = self.settings.os != "Windows"
self.options["openssl"].shared = True Hope this helps. |
thanks @czoido, this version indeed works: from conan import ConanFile
class LibDataChannel(ConanFile):
settings = "os", "arch", "compiler", "build_type"
requires = "openssl/3.2.2"
generators = "CMakeDeps"
def configure(self):
self.options["openssl"].shared = self.settings.os != "Windows" I still wonder: why do I need the generator explicitly in the python version, when I don't need it in the text version? |
That's related to these lines of cmake-conan, it behaves a bit different when you use a conanfile.txt or conanfile.py, but the warning is always there. Check here: cmake-conan/conan_provider.cmake Lines 572 to 585 in 8bf396b
I think that's to prevent fails and try not to break users from cmake-conan 1.x in the simple conanfile.txt version and as said in the comments in the code it will be mandatory in the near future to have the generator in the conanfile. I'll check with the team if we need to introduce a more visible warning there or something. Anyway, I'm glad that it finally worked. I'll keep the issue open until we decide if we have to make something in the cmake-conan side. Thanks a lot! |
Ah this makes sense. I was actually not aware I have warnings, I guess it gets drowned by all the log output from the actual compilation. I could imagine having some form of "strict mode" that just outright fails things like this. |
Hi @pschichtel, Thanks for the feedback, I'm transferring this to the cmake-conan repo to check if we want to handle the issue there in some way. |
Thanks for the feedback. This tool will remove the automatic injection of |
Describe the bug
I had this
conanfile.txt
:and I converted it to this
conanfile.py
(in order to make the shared option dynamic eventually):My expection would be, that these behave identically, but they don't.
When installing the dependencies through cmake using conan-cmake, cmake properly finds the openssl dir, but only with the .txt. When I switch to the .py it stops finding the OpenSSL_DIR and fails.
How to reproduce it
in
https://github.com/pschichtel/libdatachannel-java
you can run./gradlew :compileNativeForWindowsX8664
in the root directly. When you replace thejni/conanfile.txt
by the mentioned .py file cmake fails due to being unable to find the OpenSSL_DIR.The text was updated successfully, but these errors were encountered: