File: CMakeLists.txt

package info (click to toggle)
mrpt 1%3A2.5.8%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 87,448 kB
  • sloc: cpp: 551,662; ansic: 38,702; xml: 3,914; python: 2,547; sh: 404; makefile: 237
file content (62 lines) | stat: -rw-r--r-- 2,122 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#-----------------------------------------------------------------------------------------------
# CMake file for the MRPT example:  /system_datetime_example
#
#  Run with "ccmake ." at the root directory, or use it as a template for
#   starting your own programs
#-----------------------------------------------------------------------------------------------
set(sampleName system_datetime_example)
project(EXAMPLE_${sampleName})

cmake_minimum_required(VERSION 3.1)

# ---------------------------------------------------------------------------
# Set the output directory of each example to its corresponding subdirectory
#  in the binary tree:
# ---------------------------------------------------------------------------
set(EXECUTABLE_OUTPUT_PATH ".")

# The list of "libs" which can be included can be found in:
#  https://www.mrpt.org/Libraries
# Add the top-level dependencies only.
# --------------------------------------------------------------------------
foreach(dep system;poses;io)
	# if not building from inside MRPT source tree, find it as a cmake
	# imported project:
	if (NOT TARGET mrpt::${dep})
		find_package(mrpt-${dep} REQUIRED)
	endif()
endforeach()

# Define the executable target:
add_executable(${sampleName} test.cpp  )

if(TARGET examples)
	add_dependencies(examples ${sampleName})
endif()

set_target_properties(
	${sampleName}
	PROPERTIES
	PROJECT_LABEL "(EXAMPLE) ${sampleName}")

# Add special defines needed by this example, if any:
set(MY_DEFS )
if(MY_DEFS) # If not empty
	add_definitions("-D${MY_DEFS}")
endif()

# Add the required libraries for linking:
foreach(dep system;poses;io)
	target_link_libraries(${sampleName} mrpt::${dep})
endforeach()

# Set optimized building:
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCXX) AND NOT CMAKE_BUILD_TYPE MATCHES "Debug")
	add_compile_options(-O3)
endif()

# This part can be removed if you are compiling this program outside of
#  the MRPT tree:
if(DEFINED MRPT_LIBS_ROOT) # Fails if build outside of MRPT project.
	DeclareAppDependencies(${sampleName} mrpt::system;mrpt::poses;mrpt::io) # Dependencies
endif()