Giter Site home page Giter Site logo

Comments (7)

pschichtel avatar pschichtel commented on August 22, 2024

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.

from cmake-conan.

czoido avatar czoido commented on August 22, 2024

Hi @pschichtel,

Thanks for the question. I think that the problem could be that you need to add the CMakeDeps generator to your conanfile.py and also expand the settings to include at least the build_type. If you check your logs there should be a warning emitted by cmake-conan saying something like: Cmake-conan: CMakeDeps generator was not defined in the conanfile

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.

from cmake-conan.

pschichtel avatar pschichtel commented on August 22, 2024

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?

from cmake-conan.

czoido avatar czoido commented on August 22, 2024

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:

if(EXISTS "${CMAKE_SOURCE_DIR}/conanfile.py")
file(READ "${CMAKE_SOURCE_DIR}/conanfile.py" outfile)
if(NOT "${outfile}" MATCHES ".*CMakeDeps.*")
message(WARNING "Cmake-conan: CMakeDeps generator was not defined in the conanfile")
endif()
set(generator "")
elseif (EXISTS "${CMAKE_SOURCE_DIR}/conanfile.txt")
file(READ "${CMAKE_SOURCE_DIR}/conanfile.txt" outfile)
if(NOT "${outfile}" MATCHES ".*CMakeDeps.*")
message(WARNING "Cmake-conan: CMakeDeps generator was not defined in the conanfile. "
"Please define the generator as it will be mandatory in the future")
endif()
set(generator "-g;CMakeDeps")
endif()

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!

from cmake-conan.

pschichtel avatar pschichtel commented on August 22, 2024

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.

from cmake-conan.

czoido avatar czoido commented on August 22, 2024

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.

from cmake-conan.

memsharded avatar memsharded commented on August 22, 2024

Thanks for the feedback. This tool will remove the automatic injection of CMakeDeps and require conanfiles to explicitly define it, the warning is preventing users to start defining it explicitly to avoid future failure.

from cmake-conan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.