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

FetchContent compatibility? #13043

Closed
panpawel88 opened this issue Jun 17, 2024 · 6 comments
Closed

FetchContent compatibility? #13043

panpawel88 opened this issue Jun 17, 2024 · 6 comments

Comments

@panpawel88
Copy link

Hello,

I wanted to add Realsense library as a dependency to my project. Realsense library is added by FetchContent cmake feature. However cmake generation fails on my side.

Here is my simple CMakeLists.txt file:

cmake_minimum_required(VERSION 3.28)
project(realsense_test)

include(FetchContent)

FetchContent_Declare(
        librealsense
        GIT_REPOSITORY "https://github.com/IntelRealSense/librealsense"
        GIT_TAG "8dab5816bef30d56bc185c21132892fe41fbc146"
)

FetchContent_MakeAvailable(librealsense)

set(CMAKE_CXX_STANDARD 17)

add_executable(realsense_test main.cpp)
target_link_libraries(realsense_test librealsense)

Error log:

// ...
CMake Error at cmake-build-debug/_deps/librealsense-src/tools/CMakeLists.txt:28 (include):
  include could not find requested file:

    /home/pawel/CLionProjects/realsense-test/CMake/opengl_config.cmake
// ...

Correct path for opengl_config.cmake is /home/pawel/CLionProjects/realsense-test/cmake-build-debug/_deps/librealsense-src/CMake/opengl_config.cmake.

Is Realsense library compatible with FetchContent? In #12150 somebody wanted to clone with FetchContent, so I would expect that it should be working.

@MartyG-RealSense
Copy link
Collaborator

Hi @panpawel88 Installing RealSense with FetchContent is also discussed at the link below.

https://stackoverflow.com/questions/56593161/cmake-fetchcontent-does-not-copy-libraries

In their solution they fetch realsense2 instead of librealsense.

@MartyG-RealSense
Copy link
Collaborator

Hi @panpawel88 Do you require further assistance with this case, please? Thanks!

@panpawel88
Copy link
Author

Hello @MartyG-RealSense ,

I couldn't get it working by FetchContent, but I've added realsense dependency by using vcpkg. My issue is solved.

Thanks

@MartyG-RealSense
Copy link
Collaborator

You are very welcome. Thanks very much for the update. As you have achieved a solution, I will close this case. Thanks again!

@mprat
Copy link

mprat commented Aug 30, 2024

I actually think the issue is because the opengl configuration in librealsense is using CMAKE_SOURCE_DIR rather than PROJECT_SOURCE_DIR; I've submitted PR #13311 to fix this issue, since I was running into the same problem.

@MartyG-RealSense
Copy link
Collaborator

Thanks very much @mprat for contributing a PR!

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

No branches or pull requests

3 participants