Use zed-ros2-wrapper as third_party library

Hello there,
I’m using ubuntu 22.04, ROS2 humble
I have installed successfully zed-ros2-wrapper and run ros2 launch zed_wrapper zed_camera.launch.py camera_model:=zed2 without issues.

Now I want this repo to be a third-party of my actual workspace:

-ros2_ws
   -src
     -third-party
        -zed-ros2-wrapper
     -CMakeLists.txt

To do so I’ve had this to my CMakeLists:

add_subdirectory(third_party/zed-ros2-wrapper/zed-ros2-interfaces)
add_subdirectory(third_party/zed-ros2-wrapper/zed_ros2)
add_subdirectory(third_party/zed-ros2-wrapper/zed_components)
add_subdirectory(third_party/zed-ros2-wrapper/zed_wrapper)

The issue is, as I build my ros2_ws using colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release --parallel-workers $(nproc) --continue I get an error:

CMake Warning at third_party/zed-ros2-wrapper/zed_components/CMakeLists.txt:119 (find_package):
  By not providing "Findzed_interfaces.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "zed_interfaces", but CMake did not find one.

  Could not find a package configuration file provided by "zed_interfaces"
  with any of the following names:

    zed_interfacesConfig.cmake
    zed_interfaces-config.cmake

  Add the installation prefix of "zed_interfaces" to CMAKE_PREFIX_PATH or set
  "zed_interfaces_DIR" to a directory containing one of the above files.  If
  "zed_interfaces" provides a separate development package or SDK, be sure it
  has been installed.


CMake Error at /opt/ros/humble/share/ament_cmake_target_dependencies/cmake/ament_target_dependencies.cmake:77 (message):
  ament_target_dependencies() the passed package name 'zed_interfaces' was
  not found before
Call Stack (most recent call first):
  third_party/zed-ros2-wrapper/zed_components/CMakeLists.txt:216 (ament_target_dependencies)

How can I fix this and get my workspace built without issues?
Any help would be grateful

Hi @Remi-Tortue
Welcome to the Stereolabs community.

Your CMakeLists.txt file must specify all the dependencies, otherwise the zed_component will be built before zed_interfaces and the dependency is not satisfied:

See here, here, and here.