cmake-conan icon indicating copy to clipboard operation
cmake-conan copied to clipboard

feat: set tool path

Open tim-goto opened this issue 2 years ago • 1 comments

Scenario: I want to install build requirements with conan. In order to use them in my CMake files after the first find_package, I have to get the conan install path into CMake context.

tim-goto avatar Jun 16 '23 10:06 tim-goto

Hi @tim-goto, thank you for your contribution.

@memsharded - the proposed logic more or less matches what the CMakeToolchain does by setting CMAKE_PROGRAM_PATH. This overcomes one of the limitations mentioned in https://github.com/conan-io/cmake-conan/tree/develop2#known-limitations-with-conan-20, where find_program() doesn't work. It may not be 1:1 equivalent to what CMakeToolchain does, but it is a good approximation.

This is more or less in line with what I had in mind. @tim-goto, my suggestion (and also to echo @memsharded's concerns) is that we should be appending to CMAKE_PROGRAM_PATH, rather than create a custom CONAN_TOOL_PATH. This would enable running find_program() without any additional changes.

Although one must note that this will not work for any tool that needs to be located "during" a project() call (like a compiler, linker, build tool, etc) - but should work for anything that happens after the first find_package() call.

jcar87 avatar Sep 22 '23 12:09 jcar87