| 1 |
#----------------------------------------------------------------------------------------------- |
| 2 |
# CMake file for the MRPT example: /hwdrivers_openni2_2d_icp_slam |
| 3 |
# |
| 4 |
# Run with "ccmake ." at the root directory, or use it as a template for |
| 5 |
# starting your own programs |
| 6 |
#----------------------------------------------------------------------------------------------- |
| 7 |
set(sampleName hwdrivers_openni2_2d_icp_slam) |
| 8 |
project(EXAMPLE_${sampleName}) |
| 9 |
|
| 10 |
cmake_minimum_required(VERSION 3.16) |
| 11 |
|
| 12 |
# --------------------------------------------------------------------------- |
| 13 |
# Set the output directory of each example to its corresponding subdirectory |
| 14 |
# in the binary tree: |
| 15 |
# --------------------------------------------------------------------------- |
| 16 |
set(EXECUTABLE_OUTPUT_PATH ".") |
| 17 |
|
| 18 |
# The list of "libs" which can be included can be found in: |
| 19 |
# https://www.mrpt.org/Libraries |
| 20 |
# Add the top-level dependencies only. |
| 21 |
# -------------------------------------------------------------------------- |
| 22 |
foreach(dep hwdrivers;gui;opengl;maps) |
| 23 |
# if not building from inside MRPT source tree, find it as a cmake |
| 24 |
# imported project: |
| 25 |
if (NOT TARGET mrpt::${dep}) |
| 26 |
find_package(mrpt-${dep} REQUIRED) |
| 27 |
endif() |
| 28 |
endforeach() |
| 29 |
|
| 30 |
# Define the executable target: |
| 31 |
add_executable(${sampleName} test.cpp ) |
| 32 |
|
| 33 |
if(TARGET examples) |
| 34 |
add_dependencies(examples ${sampleName}) |
| 35 |
endif() |
| 36 |
|
| 37 |
set_target_properties( |
| 38 |
${sampleName} |
| 39 |
PROPERTIES |
| 40 |
PROJECT_LABEL "(EXAMPLE) ${sampleName}") |
| 41 |
|
| 42 |
# Add special defines needed by this example, if any: |
| 43 |
set(MY_DEFS ) |
| 44 |
if(MY_DEFS) # If not empty |
| 45 |
add_definitions("-D${MY_DEFS}") |
| 46 |
endif() |
| 47 |
|
| 48 |
# Add the required libraries for linking: |
| 49 |
foreach(dep hwdrivers;gui;opengl;maps) |
| 50 |
target_link_libraries(${sampleName} mrpt::${dep}) |
| 51 |
endforeach() |
| 52 |
|
| 53 |
# Set optimized building: |
| 54 |
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCXX) AND NOT CMAKE_BUILD_TYPE MATCHES "Debug") |
| 55 |
add_compile_options(-O3) |
| 56 |
endif() |
| 57 |
|
| 58 |
# This part can be removed if you are compiling this program outside of |
| 59 |
# the MRPT tree: |
| 60 |
if(DEFINED MRPT_LIBS_ROOT) # Fails if build outside of MRPT project. |
| 61 |
DeclareAppDependencies(${sampleName} mrpt::hwdrivers;mrpt::gui;mrpt::opengl;mrpt::maps) # Dependencies |
| 62 |
endif() |