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
I have a producer package which uses a system library libcamera. To achieve that, I added the following lines in its CMakeLists.txt,
find_package(PkgConfig)
# Then try to find system libcamera to find the corresponding cameras
pkg_check_modules(LIBCAMERA REQUIRED IMPORTED_TARGET libcamera)
message(STATUS "libcamera library found:")
message(STATUS " version: ${LIBCAMERA_VERSION}")
message(STATUS " libraries: ${LIBCAMERA_LINK_LIBRARIES}")
message(STATUS " include path: ${LIBCAMERA_INCLUDE_DIRS}")
however, in the consumer package's CMakeLists.txt, I have to do the same thing which is quite annoying. I know I can leverage find_dependency() in CMake, but as I rely on CMakeDeps generator, I don't know how to add that into the auto generated <PackageName>Config.cmake file.
After some investigation, I found a recipe tool PkgConfig in conan.tools.gnucategory. So, I think I can do something in producer's recipe, like,
and it probably will propagate the include path and library path into consumer. in which case I don't have to duplicate those CMake stuffs in consumer's CMakeLists.txt.
However, it doesn't work, because the PkgConfig.fill_cpp_info() will overwrite the self.cpp_info. I also looked into the source code of PkgConfig, it applies assignment operation for those lists in cpp_info, please see the line here, I guess line 116 could be a potential bug, because it tries to assign a different list to the cpp_info.cxxflags, or maybe the pkg-config does not support cxxflags? Another issue would be the comment of system_libs parameter in fill_cpp_info() which also affects the conan documentation, it seems like just copying the comments of 'is_system`.
Anyway, my questions are,
Is this an intentional implementation that will overwrite the incoming cpp_info anyway?
Is that possible to just append those lists into the existing lists in cpp_info?
Incidentally, I tried to pass a temporary cpp_info into it, but due to Python passing by reference feature, it will still overwrite the original self.cpp_info. Besides that, I also tried to copy.deepcopy(), but for some reason, it gives me a TypeError exception. So, my current solution is,
copy every lists in self.cpp_info into some temporary lists
invoke fill_cpp_info(self.cpp_info)
append those copied temporary lists back to the self.cpp_info
I don't think this is a decent solution, I would expect to do those in fill_cpp_info().
Have you read the CONTRIBUTING guide?
I've read the CONTRIBUTING guide
The text was updated successfully, but these errors were encountered:
I think you might use a different approach, like first getting the cpp_info object of PkgConfig, then merging that information with the existing one, instead of overwriting it.
What is your question?
I have a producer package which uses a system library
libcamera
. To achieve that, I added the following lines in itsCMakeLists.txt
,however, in the consumer package's
CMakeLists.txt
, I have to do the same thing which is quite annoying. I know I can leveragefind_dependency()
inCMake
, but as I rely onCMakeDeps
generator, I don't know how to add that into the auto generated<PackageName>Config.cmake
file.After some investigation, I found a recipe tool
PkgConfig
inconan.tools.gnu
category. So, I think I can do something in producer's recipe, like,and it probably will propagate the include path and library path into consumer. in which case I don't have to duplicate those
CMake
stuffs in consumer'sCMakeLists.txt
.However, it doesn't work, because the
PkgConfig.fill_cpp_info()
will overwrite theself.cpp_info
. I also looked into the source code ofPkgConfig
, it applies assignment operation for those lists incpp_info
, please see the line here, I guess line 116 could be a potential bug, because it tries to assign a different list to thecpp_info.cxxflags
, or maybe thepkg-config
does not supportcxxflags
? Another issue would be the comment ofsystem_libs
parameter infill_cpp_info()
which also affects the conan documentation, it seems like just copying the comments of 'is_system`.Anyway, my questions are,
cpp_info
anyway?cpp_info
?Incidentally, I tried to pass a temporary
cpp_info
into it, but due to Python passing by reference feature, it will still overwrite the originalself.cpp_info
. Besides that, I also tried tocopy.deepcopy()
, but for some reason, it gives me aTypeError
exception. So, my current solution is,self.cpp_info
into some temporary listsfill_cpp_info(self.cpp_info)
self.cpp_info
I don't think this is a decent solution, I would expect to do those in
fill_cpp_info()
.Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: