conan icon indicating copy to clipboard operation
conan copied to clipboard

[question] Pass a PATH to be used by consumer

Open Facon opened this issue 3 years ago • 1 comments

I would like to now how can I pass a path to some executables from an installed packaged.

Let's say that I have installed a package AAA that contains the following structure: .conan/data/AAA/1.0/_/_/package/HASH/ ├───tools │       └───linux ├───include └────lib             └───linux .conan/data/AAA/1.0/_/_/package/HASH2/ ├───tools │       └───windows ├───include └────lib             └───windows

The package can be used as normal, but I would like to now how the consumer can use the tools inside the tools folder for CMake's add_custom_command.

Facon avatar Jul 25 '22 08:07 Facon

Hi @Facon

With new tooling is:

def package_info(self):
     self.buildenv_info.append_path("PATH", <path>)
     # where path can do os.path.join(self.package_folder, ...) for example

Then on the consumer side, use the VirtualBuildEnv generator. That would add that to the path, which will be in a file that you (as developer) can activate or source, and that Conan will automatically use in the self.run(...) commands.

memsharded avatar Jul 25 '22 10:07 memsharded