<div dir="ltr">Hello,<div><br></div><div>I'm trying to fix a project so that its output is relocatable.  The project is a library that itself depends on libpcap.  My goal is to be able to import the library into my CMake application and have CMake automatically link libpcap with it.</div><div><br></div><div>I'm using a toolchain file that invokes an ARM cross compiler, sets CMAKE_INSTALL_PREFIX and appends it to CMAKE_FIND_ROOT_PATH.  This all seems to work well.</div><div><br></div><div>What I'm seeing is that the exported files that get installed to CMAKE_INSTALL_PREFIX contain absolute paths to libpcap on my machine, which make them useless to other team members.</div><div><br></div><div>The first thing I changed was to use CONFIGURE_PACKAGE_CONFIG_FILE instead of CONFIGURE_FILE.  This got rid of absolute paths in the generated CMake config file.</div><div><div><br></div><div>However, I still have absolute paths in the CMake target import file that gets generated.  The IMPORTED_LINK_INTERFACE_LIBRARIES target property has an absolute path instead of one relative to CMAKE_INSTALL_PREFIX.</div><div><br></div><div>I've read the "Creating Relocatable Packages" [1] section of the CMake packages documentation. I'm pretty sure this is what I'm running into, but I don't quite understand how to solve it.  The documentation says that I should be using imported targets, but I'm not sure how to do so.  The library is just using its own FindPCAP.cmake file to locate libpcap.</div></div><div><br></div><div>Does anyone know of an example of a CMake package that imports other libraries?  I could also try to create a minimal example project with this setup if it would be helpful.</div><div><br></div><div>Thanks,</div><div>Zac</div><div><br></div><div>[1]: <a href="https://cmake.org/cmake/help/v3.3/manual/cmake-packages.7.html#creating-relocatable-packages">https://cmake.org/cmake/help/v3.3/manual/cmake-packages.7.html#creating-relocatable-packages</a></div><div><br></div></div>