Closed fred-apex-ai closed 4 years ago
@esteve I missed the fact that you pushed a commit to my branch and so I wasted quite some time experimenting around. Now I understand the scope of the vendor package, I need both
find_package(osqp_vendor REQUIRED)
find_package(osqp REQUIRED)
then it works. Sorry for the confusion. I still think that the build system and the cmake files aren't organized according to modern cmake best practices but let's ignore that for now
@fred-apex-ai
This blog post describes how to properly add properties to targets for downstream consumption.
Can you paste the link to the blog post you mention?
Manually a target is added in osqp_vendor-extras.cmake so osqp_vendor_TARGETS=osqp but it's not a real target; i.e. I can't print out its properties, can't get its link or include directories etc.
osqp
is a real target exported by the osqp package (https://github.com/oxfordcontrol/osqp/blob/master/CMakeLists.txt#L284), osqp_vendor
reexports that target to be used by downstream packages.
Sorry for the confusion. I still think that the build system and the cmake files aren't organized according to modern cmake best practices but let's ignore that for now
AFAIK, the modern approach to inter-package dependencies in CMake >= 3.0 (https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/) is to use targets instead of variables for include dirs, libraries, etc.
In any case, could you elaborate what you mean by modern CMake best practices? Thanks.
@esteve Sorry if I caused you confusion, it spun off from my own confusion. Yes I forgot to add the link but you found it anyhow :) https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/ I meant that for modern cmake best practices
From what I could tell, but correct me if I'm wrong, ament_*
things communicate information between packages via variables, not via targets, and targets aren't namespaced etc. But the issue is more me wanting to understand exactly what happens behind the scenes, nothing for you to fix. Now I looked further and saw that NAMESPACE
is used in https://github.com/ament/ament_cmake/blob/933e2838c0404fd061479e0a826947dfc35e81de/ament_cmake_export_targets/cmake/ament_cmake_export_targets_package_hook.cmake#L31 but I'm not sure if this hook is called. How could I check the exported targets of a package that I import/depend on?
Manually a target is added in osqp_vendor-extras.cmake so osqp_vendor_TARGETS=osqp but it's not a real target; i.e. I can't print out its properties, can't get its link or include directories etc.
osqp is a real target exported by the osqp package (https://github.com/oxfordcontrol/osqp/blob/master/CMakeLists.txt#L284), osqp_vendor reexports that target to be used by downstream packages.
Yes, I saw that, too. My problem was that I hadn't it imported it properly, so the target didn't exist.
@esteve I tried to use the
osqp_vendor
package inosqp_interface
. This a commit documenting things I tried. I failed. Can you please give me instructions on how to consume that vendor package?When I print out all variables involving
osqp_vendor
, I getThe issue
compilation error
the include directories are not defined
THere is no
-I
argument introducing theosqp
source directory in the call toc++
. And there is noosqp_vendor_*
variable to cover that, so I can't even introduce it manually in myCMakeLists.txt
targets
Manually a target is added in
osqp_vendor-extras.cmake
soosqp_vendor_TARGETS=osqp
but it's not a real target; i.e. I can't print out its properties, can't get its link or include directories etc. This blog post describes how to properly add properties to targets for downstream consumption. As far as I can tell,osqp_vendor
falls short in most ways but I may be missing something because of the interaction with ament.