-
Notifications
You must be signed in to change notification settings - Fork 37
/
CMakeLists.txt
95 lines (72 loc) · 3.97 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
#
# Author: Cillian O'Driscoll, cillian dot odriscoll (at) gmail dot com
#
# Based on the root CMakeLists.txt file of the gnss-sdr project:
# http://github.com/gnss-sdr/gnss-sdr
#
# Copyright(c) 2015 Institute of Navigation
# http://www.ion.org
#
# This Metadata Converter is free software; you can redistribute it and/or
# modify it under the terms of the Lesser GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Lesser GNU General Public License for more details.
#
# You should have received a copy of the Lesser GNU General Public License
# along with Metadata API. If not, see <http://www.gnu.org/licenses/>.
#
########################################################################
# Project setup
########################################################################
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(WARNING "In-tree build is bad practice. Try 'cd build && cmake ../' ")
endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
cmake_minimum_required(VERSION 2.8)
project(GNSS_METADATA_STANDARD CXX C)
file(RELATIVE_PATH RELATIVE_CMAKE_CALL ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
################################################################################
# Checkout cmake version
################################################################################
if(CMAKE_VERSION VERSION_LESS 2.8.8)
message(STATUS "Your CMake version is too old and does not support some features required by GNSS-Metadata. CMake version must be at least 2.8.8. For more information check https://github.com/joakimkarlsson/bandit/issues/40")
message(FATAL_ERROR "Fatal error: CMake >= 2.8.8 required.")
endif(CMAKE_VERSION VERSION_LESS 2.8.8)
################################################################################
# Checkout compiler version
################################################################################
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
message(STATUS "Your GCC version is too old and does not support some C++11 features required by GNSS-Metadata. GCC version must be at least 4.7")
message(FATAL_ERROR "Fatal error: GCC >= 4.7 required.")
endif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
########################################################################
# Set compiler flags
########################################################################
# Enable C++11 support in GCC
# For "-std=c++0x" GCC's support for C++11 see http://gcc.gnu.org/projects/cxx0x.html
if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11 -Wall -Wextra -pedantic") #Add warning flags: For "-Wall -pedantic" see http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
endif(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11 -Wno-c++11-narrowing -Wall -pedantic")
if(CMAKE_BUILD_TYPE MATCHES "Release")
set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -Wno-unused-private-field")
endif(CMAKE_BUILD_TYPE MATCHES "Release")
endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
#http://gcc.gnu.org/wiki/Visibility
add_definitions(-fvisibility=hidden -Wno-unused-parameter -Wno-unused-but-set-variable )
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_CXX_FLAGS}")
########################################################################
# Add subdirectories (in order of deps)
########################################################################
SET( BUILD_TEST_EXECUTABLES TRUE )
add_subdirectory(source)
message( ${CMAKE_CXX_FLAGS} )