-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
150 lines (123 loc) · 5.83 KB
/
CMakeLists.txt
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#=======================================================================
# FILE: moos-ivp-extend/CMakeLists.txt
# DATE: 2012/07/24
# INFO: Top-level CMakeLists.txt file for the moos-ivp-extend project
# NAME: Maintained by Mike Benjamin - Original setup by Christian Convey
# Chris Gagner, and tips borrowed from Dave Billin
#=======================================================================
CMAKE_MINIMUM_REQUIRED(VERSION 3.3)
PROJECT( IVP_EXTEND )
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
set (CMAKE_CXX_STANDARD 11)
#=======================================================================
# Set the output directories for the binary and library files
#=======================================================================
GET_FILENAME_COMPONENT(IVP_EXTEND_BIN_DIR "${CMAKE_SOURCE_DIR}/bin" ABSOLUTE )
GET_FILENAME_COMPONENT(IVP_EXTEND_LIB_DIR "${CMAKE_SOURCE_DIR}/lib" ABSOLUTE )
GET_FILENAME_COMPONENT(IVP_EXTEND_INC_DIR "${CMAKE_SOURCE_DIR}/include" ABSOLUTE )
SET( LIBRARY_OUTPUT_PATH "${IVP_EXTEND_LIB_DIR}" CACHE PATH "" )
SET( ARCHIVE_OUTPUT_DIRECTORY "${IVP_EXTEND_LIB_DIR}" CACHE PATH "" )
SET( LIBRARY_OUTPUT_DIRECTORY "${IVP_EXTEND_LIB_DIR}" CACHE PATH "" )
SET( EXECUTABLE_OUTPUT_PATH "${IVP_EXTEND_BIN_DIR}" CACHE PATH "" )
SET( RUNTIME_OUTPUT_DIRECTORY "${IVP_EXTEND_BIN_DIR}" CACHE PATH "" )
INCLUDE_DIRECTORIES(${IVP_EXTEND_INC_DIR})
#=======================================================================
# Find Protocol buffers
#=======================================================================
find_package(ProtobufLocal REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIRS})
if(${PROTOC_VERSION} VERSION_LESS 2.5.0})
message("libprotobuf < 2.5.0")
else()
message("libprotobuf >= 2.5.0")
set(PROTOBUF_ALLOW_ALIAS "option allow_alias = true;")
endif()
#=======================================================================
# Find MOOS
#=======================================================================
find_package(MOOS 10.0)
INCLUDE_DIRECTORIES(${MOOS_INCLUDE_DIRS})
#=======================================================================
# FINDING MOOSGeodesy' HEADERS AND LIBRARIES...
#=======================================================================
find_package(MOOSGeodesy)
include_directories(${MOOSGeodesy_INCLUDE_DIRS})
link_directories(${MOOSGeodesy_LIBRARY_PATH})
message("+++++++++++++++++++++++++++++++++++++++++")
message("MOOSGeodesy_INCLUDE_DIRS:" ${MOOSGeodesy_INCLUDE_DIRS})
message("MOOSGeodesy_LIB_PATH:" ${MOOSGeodesy_LIBRARY_PATH})
message("+++++++++++++++++++++++++++++++++++++++++")
#=======================================================================
# Find the "moos-ivp" base directory
#=======================================================================
# Search for the moos-ivp folder
find_path( MOOSIVP_SOURCE_TREE_BASE
NAMES build-ivp.sh build-moos.sh configure-ivp.sh
PATHS "~/moos-ivp" "/moos-ivp"
DOC "Base directory of the MOOS-IvP source tree"
NO_DEFAULT_PATH
)
if (NOT MOOSIVP_SOURCE_TREE_BASE)
message("Please set MOOSIVP_SOURCE_TREE_BASE to ")
message("the location of the \"moos-ivp\" folder ")
return()
endif()
#======================================================================
# Specify where to find IvP's headers and libraries...
#======================================================================
FILE(GLOB IVP_INCLUDE_DIRS ${MOOSIVP_SOURCE_TREE_BASE}/ivp/src/lib_*)
INCLUDE_DIRECTORIES(${IVP_INCLUDE_DIRS})
FILE(GLOB IVP_LIBRARY_DIRS ${MOOSIVP_SOURCE_TREE_BASE}/lib)
LINK_DIRECTORIES(${IVP_LIBRARY_DIRS})
#=======================================================================
# Find the "B64"
#=======================================================================
# b64 for the interface
find_package(B64 REQUIRED)
set(B64_DOC_STRING "Enable base64 functionality (requires libb64-dev: http://libb64.sourceforge.net/")
if(B64_FOUND)
option(enable_b64 ${B64_DOC_STRING} ON)
else()
option(enable_b64 ${B64_DOC_STRING} OFF)
message(">> setting enable_b64 to OFF ... if you need this functionality: 1) install libb64-dev; 2) run cmake -Denable_b64=ON")
endif()
include_directories(${B64_INCLUDE_DIRS})
#======================================================================
# Specify Compiler Flags
#======================================================================
IF( ${WIN32} )
#---------------------------------------------
# Windows Compiler Flags
#---------------------------------------------
IF(MSVC)
# Flags for Microsoft Visual Studio
SET( WALL_ON OFF CACHE BOOL
"tell me about all compiler warnings (-Wall) ")
IF(WALL_ON)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
ENDIF(WALL_ON)
ELSE(MSVC)
# Other Windows compilers go here
ENDIF(MSVC)
ELSE( ${WIN32} )
#---------------------------------------------
# Linux and Apple Compiler Flags
#---------------------------------------------
# Force -fPIC because gcc complains when we don't use it with x86_64 code.
# Note sure why: -fPIC should only be needed for shared objects, and
# AFAIK, CMake gets that right when building shared objects. -CJC
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -g -Wdeprecated-declarations")
IF(CMAKE_COMPILER_IS_GNUCXX)
# Flags for the GNU C++ Compiler
SET( WALL_ON OFF CACHE BOOL
"tell me about all compiler warnings (-Wall) ")
IF(WALL_ON)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" -C++11)
ENDIF( WALL_ON)
ELSE(CMAKE_COMPILER_IS_GNUCXX)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ENDIF( ${WIN32} )
#=======================================================================
# Add Subdirectories
#=======================================================================
ADD_SUBDIRECTORY( src )