conan: [question] Conan 1.45.0 does not add root folders to `CMAKE_PREFIX_PATH`
I just read the following in the documentation for CMakeToolchain
:
Note
In Conan 1.45 the CMakeToolchain doesn’t append the root package folder of the dependencies (declared in the cpp_info.builddirs) to the CMAKE_PREFIX_PATH variable. That interfered with the find_file, find_path and find_program, making, for example, impossible to locate only the executables from the build context. In Conan 2.0, the cppinfo.builddirs won’t contain by default the ‘’ entry (root package).
I am running conan 1.45.0, and this behavior inteferes highly with the possibility to locate <deps>Config.cmake
files.
CMake has the following behavior:
Find<Dep>.cmake
are located in CMAKE_MODULE_PATH
, while <Dep>Config.cmake
files are searched for in certain subfolders of CMAKE_PREFIX_PATH
.
I am not sure, if the problem you are describing will explicitly be solved by not setting the CMAKE_PREFIX_PATH
.
In general, for cross compile scenarios, you control cmake variables like CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
and CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
to customize the find_library behavior.
I guess Conan knows, what packages are build requirements, and which ones regular requirements, and thus can control the build.
However, not setting the CMAKE_PREFIX_PATH
will certainly break our workflow.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (9 by maintainers)
@lasote It appears this is no longer true? I’m setting
self.cpp_info.builddirs = ['xyz']
, and I see~/.conan/data/.../package/.../xyz
prepended toCMAKE_MODULE_PATH
by theCMakeToolchain
generator, but nothing I do can change the line that touchesCMAKE_PREFIX_PATH
:I guess it’s ok and we can live with the current approach 😄