You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Environment Details (include every applicable attribute)
Operating System+version: Ubuntu 20 (Building in an Ubuntu docker image)
Compiler+version: gcc9
Conan version: 1.46.0
Python version: 3.8.10
Steps to reproduce (Include if Applicable)
I have a large package that I am building and would like to create two packages, one with everything and the other removing a few features. I have overloaded the build_id function in my conanfile.py. I have discovered that if patch_config_paths is called in the conanfile, then the conan create commands after the first will fail. Cmake fails to find project dependencies.
The CMake.patch_config_paths function replaces hardcoded paths in the build and package folder with ${CONAN_<project_name>_ROOT}. When the CMakeDeps generator produces the cmake config files in the build folder, it replaces instances of ${CONAN_<project_name>_ROOT} with a hardcoded path. When using build id, the generator is not rerun with every subsequent command.
As a concrete example, when I run the CMakeDeps generator, it produces a Boost-release-x86_64-data.cmake in my build_folder that contains the following line:
When I attempt to create the second package, CMake complains that it can't find Boost, which makes sense because CONAN_BOOST_ROOT isn't defined. It ends up looking in the wrong place.
I'm not sure why CMake.patch_config_paths replaces files in the build directory since those files are not a part of the final package. I'm guessing that this could be fixed by only replacing files in the package directory, but there may be something that I don't understand going on. If nothing else, I don't think that it should replace paths in the files produced by the CMakeDeps generator.
Logs (Executed commands with output) (Include/Attach if Applicable)
-- Conan: Target declared 'boost::boost'
CMake Error at /root/.conan/data/gnuradio/3.8.3.1/_/_/build/bfa6f102a7af0393db8c8868635ddbf91f756c5a/cmakedeps_macros.cmake:4 (message):
Library 'boost_log_setup' not found in package. If 'boost_log_setup' is a
system library, declare it with 'cpp_info.system_libs' property
Call Stack (most recent call first):
/root/.conan/data/gnuradio/3.8.3.1/_/_/build/bfa6f102a7af0393db8c8868635ddbf91f756c5a/cmakedeps_macros.cmake:50 (conan_message)
/root/.conan/data/gnuradio/3.8.3.1/_/_/build/bfa6f102a7af0393db8c8868635ddbf91f756c5a/Boost-Target-release.cmake:21 (conan_package_library_targets)
/root/.conan/data/gnuradio/3.8.3.1/_/_/build/bfa6f102a7af0393db8c8868635ddbf91f756c5a/BoostTargets.cmake:26 (include)
/root/.conan/data/gnuradio/3.8.3.1/_/_/build/bfa6f102a7af0393db8c8868635ddbf91f756c5a/BoostConfig.cmake:11 (include)
cmake/Modules/GrBoost.cmake:88 (find_package)
CMakeLists.txt:363 (include)
The text was updated successfully, but these errors were encountered:
The CMake.patch_config_paths belongs to the legacy CMake generator, not to the from conan.tools.cmake import CMake modern one.
You cannot mix the legacy tools with the new ones, like CMakeDeps. If you are going to use CMakeDeps, please use the matching from conan.tools.cmake import CMake helper.
Also, the CMake.patch_config_paths is not intended to modify the files created by the Conan generators, but instead to patch some of the current package cmake files generated by CMake, to make them location agnostic before packaging.
Note: the patch_config_paths is no longer implemented in the new integrations.
Note: the patch_config_paths is no longer implemented in the new integrations.
I noticed that fact while porting recipes to conan 2.0 just recently. What is the rational behind removing this feature and what would be the migration path?
Environment Details (include every applicable attribute)
Steps to reproduce (Include if Applicable)
I have a large package that I am building and would like to create two packages, one with everything and the other removing a few features. I have overloaded the build_id function in my conanfile.py. I have discovered that if
patch_config_paths
is called in the conanfile, then the conan create commands after the first will fail. Cmake fails to find project dependencies.The
CMake.patch_config_paths
function replaces hardcoded paths in the build and package folder with${CONAN_<project_name>_ROOT}
. When the CMakeDeps generator produces the cmake config files in the build folder, it replaces instances of${CONAN_<project_name>_ROOT}
with a hardcoded path. When using build id, the generator is not rerun with every subsequent command.As a concrete example, when I run the CMakeDeps generator, it produces a Boost-release-x86_64-data.cmake in my build_folder that contains the following line:
After my recipe executes CMake.patch_config_paths the file now contains:
When I attempt to create the second package, CMake complains that it can't find Boost, which makes sense because CONAN_BOOST_ROOT isn't defined. It ends up looking in the wrong place.
I'm not sure why CMake.patch_config_paths replaces files in the build directory since those files are not a part of the final package. I'm guessing that this could be fixed by only replacing files in the package directory, but there may be something that I don't understand going on. If nothing else, I don't think that it should replace paths in the files produced by the CMakeDeps generator.
Logs (Executed commands with output) (Include/Attach if Applicable)
The text was updated successfully, but these errors were encountered: