Git Product home page Git Product logo

Comments (2)

memsharded avatar memsharded commented on June 20, 2024

Hi @rconde01

If I understood correctly, you have a Python script in one of your dependencies, and you want to run that script from the CMakeLists.txt of a consumer of that dependency, that has a requires() or tool_requires to it?

Would the explicit way be good for your use case? Something like:

requires = "mydep/0.1"

def  generate(self):
    tc = CMakeToolchain(self)
    tc.variables["PATH_TO_MY_PYTHON_SCRIPT"] = os.path.join(self.dependencies["mydep"].cpp_info.bindir, "myscript.py")
    tc.generate()

from conan.

rconde01 avatar rconde01 commented on June 20, 2024

I did a slight variation which was:

class my_tool(ConanFile):
   def package_info(self):
      self.cpp_info.set_property(my_tool_py", join(self.package_folder, "bin", "my_tool.py"))
def generate(self):
   tc= CMakeToolchain(self)
   tc.variables["MY_TOOL_PATH"] = self.dependencies["my_tool"].cpp_info.get_property("my_tool_py")
   tc.generate()

which works well - except on windows the path ends up in the variable with unescaped backslashes. I can manually fix that up but maybe CMakeToolchain should be doing that?

from 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.