Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: include directories not propagated with target #404

Open
KerstinKeller opened this issue Mar 21, 2023 · 1 comment
Open

CMake: include directories not propagated with target #404

KerstinKeller opened this issue Mar 21, 2023 · 1 comment

Comments

@KerstinKeller
Copy link

When you build and install libde265 with CMake, you cannot properly use the library after using target_link_libraries, because the include directories are not propagated properly.

The reason is this line:

install(FILES ${libde265_public_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libde265)

You also need to state where the header files can be found in the installed case, for an example like this:
https://github.com/eclipse-ecal/tcp_pubsub/blob/4ceafb6b55ce41149ed9473dae7e8ea37235a3cc/tcp_pubsub/CMakeLists.txt#L96-L103

Sample CMakeLists.txt file to use libde265:

cmake_minimum_required(VERSION 3.15)
project(libde265PackageTest CXX)

find_package(libde265 REQUIRED)
add_executable(libde265_test libde265_test.cpp)
target_link_libraries(libde265_test PRIVATE  de265)

Building a sample then fails:

fatal error: de265-version.h: No such file or directory

Would you accept a PR to address this issue?
At the same time I would recommend to export targets into a namespace so they can be linked with libde265::libde265, to make clear to CMake that this target is imported and then it gets better diagnostics if it cannot be found.

@farindk
Copy link
Contributor

farindk commented Mar 21, 2023

Thank you.
Sure, if you have a PR ready, I would integrate this. I don't know all CMake details, so every input is welcome.
Please note that we currently can only use CMake up to 3.10 (preferably a bit lower) because of the packaging for old distributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants