If you make install libtins to the system's default location, a user only needs to do:
find_package(libtins CONFIG REQUIRED)
target_link_libraries(mytarget PUBLIC tins)
and #include <tins/tins.h> works because the headers can be found in the default location.
However, if you installed libtins to a different path using -DCMAKE_INSTALL_PREFIX=mypath and help cmake find libtins using -DCMAKE_PREFIX_PATH=mypath, cmake can't find the header files.
To my understanding, this happens because libtins' CmakeLists.txt doesn't call target_include_directories on the tins target. If it did and the export code does its work, the call to target_link_libraries shown above would automatically pull in the include directory in mypath/include and add them to the mytarget target.
libtins does provide the LIBTINS_INCLUDE_DIRS variable, but for me at least that points to the include directory in the cloned git repo, which isn't ideal (may be similar to #340).
I'd love to create a pull request but I don't know enough about CMake to know how to do this properly, let alone to integrate this into the current CMakeLists.txt
If you
make install
libtins to the system's default location, a user only needs to do:and
#include <tins/tins.h>
works because the headers can be found in the default location.However, if you installed libtins to a different path using
-DCMAKE_INSTALL_PREFIX=mypath
and help cmake find libtins using-DCMAKE_PREFIX_PATH=mypath
, cmake can't find the header files.To my understanding, this happens because libtins' CmakeLists.txt doesn't call
target_include_directories
on thetins
target. If it did and the export code does its work, the call totarget_link_libraries
shown above would automatically pull in the include directory inmypath/include
and add them to themytarget
target.libtins does provide the
LIBTINS_INCLUDE_DIRS
variable, but for me at least that points to the include directory in the cloned git repo, which isn't ideal (may be similar to #340).I'd love to create a pull request but I don't know enough about CMake to know how to do this properly, let alone to integrate this into the current CMakeLists.txt