I’ve got a project which requires a fast-dds library (GitHub - eProsima/Fast-DDS: The most complete DDS - Proven: Plenty of success cases.). This library relies on several third party libraries. Those are included in the “thirdparty” directory as git submodules or the module allows to use system wide libraries.
However, fast-dds relies also on foonathan-memory-vendor package (GitHub - eProsima/foonathan_memory_vendor: foonathan/memory vendor package for Fast DDS.) which is not part of the repository compared to other libraries + it turns out to be some sort of wrapper around memory package.
I want to be able to build my project, which relies on fast-dds without the need of manually downloading and installing any of the third party packages and I would like to configure the build system in such a way, it uses local packages.
So I’ve created a testing directory like this:
my_project |--3rdparty | |--Fast-DDS # git submodule | |--foonathan_memory_vendor # git submodule |--CMakeLists.txt
My CMakeLists.txt file looks following way:
1 cmake_minimum_required (VERSION 3.16)
5 set (THIRDPARTY ON CACHE STRING “” FORCE)
6 set (BUILD_SHARED_LIBS OFF CACHE STRING “” FORCE)
Invoking cmake under my_project like:
$ cmake -S . -B build
leads to following issue:
Could not find a package configuration file provided by
“foonathan_memory_vendor” with any of the following names:
Add the installation prefix of “foonathan_memory_vendor” to
CMAKE_PREFIX_PATH or set “foonathan_memory_vendor_DIR” to a directory
containing one of the above files. If “foonathan_memory_vendor” provides a
separate development package or SDK, be sure it has been installed.
After investigating the issue I found out, that fast-dds CMakeLists.txt file invokes “find_package(foonathan_memory_vendor)”, however, the package is not installed on the system, thus package configuration file is missing and thus it’s not able to locate it.
I was reading the find_package documentation and it feels, like find_package is only for installed packages or am I wrong?
I’ve tried to invoke cmake on the foonathan_memory_vendor ($ cmake -S . -B build) package and the foonathan_memory_vendor-config.cmake becomes part of the build directory, however, the package requires the foonathan_memory package and it “includes” it using “externalproject_add” command.
So my question to this topic and also a generic question would be:
How does one incorporates a third party library, which uses find_package to search for additional packages, but I don’t have and don’t want to install those packages system wide. I just want to build those packages as part of the whole build of my project locally.