You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Artem-Darius Weber
bb2dc1e41e
|
2 months ago | |
---|---|---|
.. | ||
CMakeLists.txt | 2 months ago | |
hello_librealsense2.cpp | 2 months ago | |
readme.md | 2 months ago |
readme.md
CMake Sample
Overview
This sample demonstrates how to create a basic librealsense application using CMake. Currently this sample is supported only by Linux OS.
Prerequisite
Install the SDK or build it from source (Linux)
Expected Output
Code Overview
Set minimum required CMake version
cmake_minimum_required(VERSION 3.1.0)
Name the project, in this sample the project name will be also the executable name
project(hello_librealsense2)
Find librealsense installation, this feature is currently available only for Linux
# Find librealsense2 installed package
find_package(realsense2 REQUIRED)
Enable C++11 standard in the application
# Enable C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
Point to the source files, in this simple example we have only one cpp file
# Add the application sources to the target
add_executable(${PROJECT_NAME} hello_librealsense2.cpp)
Link librealsense, the variable ${realsense2_LIBRARY} is set by "find_package"
# Link librealsense2 to the target
target_link_libraries(${PROJECT_NAME} ${realsense2_LIBRARY})