how to use static library which find_package() by another catkin package

asked 2020-08-26 03:41:22 -0500

Cry-A-Lot gravatar image

updated 2020-08-26 03:41:53 -0500

this is my workspace tree

  .
    └── src
        ├── pkg_b
        │   ├── CMakeLists.txt
        │   ├── include
        │   │   └── pkg_b
        │   ├── package.xml
        │   └── src
        │       └── main.cpp
        └── pkg_pcl
            ├── CMakeLists.txt
            ├── include
            │   └── pkg_pcl
            │       ├── bin
            │       ├── include
            │       ├── lib
            │       └── share
            ├── package.xml
            └── src

I would like to use static library which in my case I want to use PCL library that locate at ./src/pkg_pcl/include/pkg_pcl I want to create catkin package that find this library then share it with another package. so ./src/pkg_pcl/CMakeLists.txt might look like this

cmake_minimum_required(VERSION 3.0.2)
project(pkg_pcl)

find_package(PCL REQUIRED NO_DEFAULT_PATH  PATHS ${CMAKE_CURRENT_SOURCE_DIR}/include/pkg_pcl)

and ./src/pkg_b/CMakeLists.txt just look like this :

cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(pkg_b)

find_package(pkg_pcl)

NOTE : I want package pkg_b to use find_package(pkg_pcl) which can link to PCL library instead of find_package(PLC) which might find package in shared library.

is it possible to do this ?

edit retag flag offensive close merge delete