-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathCMakeCompiler.txt
More file actions
executable file
·94 lines (92 loc) · 5.02 KB
/
CMakeCompiler.txt
File metadata and controls
executable file
·94 lines (92 loc) · 5.02 KB
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
# Copyright 2008 28msec, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#-----------------------------------------------------------------------------
# Let's use the highest warning level.
#-----------------------------------------------------------------------------
IF(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake)")
# # Use the highest warning level for visual studio.
# IF(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
# STRING(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# ELSE(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
# ENDIF(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
# IF(CMAKE_C_FLAGS MATCHES "/W[0-4]")
# STRING(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
# ELSE(CMAKE_C_FLAGS MATCHES "/W[0-4]")
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
# ENDIF(CMAKE_C_FLAGS MATCHES "/W[0-4]")
# # Disable deprecation warnings for standard C functions in VS2005 and later
# IF(CMAKE_COMPILER_2005)
# ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
# ENDIF(CMAKE_COMPILER_2005)
ENDIF(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake)")
IF(CMAKE_COMPILER_IS_GNUCXX)
IF(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
ENDIF(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
IF(NOT CMAKE_CXX_FLAGS MATCHES "-Wextra")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
ENDIF(NOT CMAKE_CXX_FLAGS MATCHES "-Wextra")
# # Wabi (Warn when G++ generates code that is probably not compatible with the vendor-neutral C++ ABI.)
# IF(NOT CMAKE_CXX_FLAGS MATCHES "-Wabi")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wabi")
# ENDIF(NOT CMAKE_CXX_FLAGS MATCHES "-Wabi")
# Warn when a class seems unusable because all the constructors or destructors in that class are private, and it has neither friends nor public static member functions.
IF(NOT CMAKE_CXX_FLAGS MATCHES "-Wctor-dtor-privacy")
IF (NOT APPLE) # apple g++ throws to many of these warnings for boost
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wctor-dtor-privacy")
ENDIF (NOT APPLE)
ENDIF(NOT CMAKE_CXX_FLAGS MATCHES "-Wctor-dtor-privacy")
# # Warn about violations of the following style guidelines from Scott Meyers’ Effective C++ book (Problem: std header do not obey this guideline)
# IF(NOT CMAKE_CXX_FLAGS MATCHES "-Weffc++")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weffc++")
# ENDIF(NOT CMAKE_CXX_FLAGS MATCHES "-Weffc++")
# # Warn if an old-style (C-style) cast to a non-void type is used within a C++ program.
# IF(NOT CMAKE_CXX_FLAGS MATCHES "-Wold-style-cast")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast")
# ENDIF(NOT CMAKE_CXX_FLAGS MATCHES "-Wold-style-cast")
# Warn when a function declaration hides virtual functions from a base class.
IF(NOT CMAKE_CXX_FLAGS MATCHES "-Woverloaded-virtual")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual")
ENDIF(NOT CMAKE_CXX_FLAGS MATCHES "-Woverloaded-virtual")
# Warn when overload resolution chooses a promotion from unsigned or enumerated type to a signed type, over a conversion to an unsigned type of the same size.
IF(NOT CMAKE_CXX_FLAGS MATCHES "-Wsign-promo")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-promo")
ENDIF(NOT CMAKE_CXX_FLAGS MATCHES "-Wsign-promo")
# Warn about uninitialized variables which are initialized with themselves.
IF(NOT CMAKE_CXX_FLAGS MATCHES "-Winit-self")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Winit-self")
ENDIF(NOT CMAKE_CXX_FLAGS MATCHES "-Winit-self")
# # Warn if a user-supplied include directory does not exist.
# IF(NOT CMAKE_CXX_FLAGS MATCHES "-Wmissing-include-dirs")
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-include-dirs")
# ENDIF(NOT CMAKE_CXX_FLAGS MATCHES "-Wmissing-include-dirs")
# Temporarly supresses the unused parameter warning
IF(NOT CMAKE_CXX_FLAGS MATCHES "-Wno-unused-parameter")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
ENDIF(NOT CMAKE_CXX_FLAGS MATCHES "-Wno-unused-parameter")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
IF(CMAKE_COMPILER_IS_GNUCC)
IF(NOT CMAKE_C_FLAGS MATCHES "-Wall")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
ENDIF(NOT CMAKE_C_FLAGS MATCHES "-Wall")
IF(NOT CMAKE_C_FLAGS MATCHES "-Wextra")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra")
ENDIF(NOT CMAKE_C_FLAGS MATCHES "-Wextra")
# Warn about uninitialized variables which are initialized with themselves.
IF(NOT CMAKE_C_FLAGS MATCHES "-Winit-self")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Winit-self")
ENDIF(NOT CMAKE_C_FLAGS MATCHES "-Winit-self")
ENDIF(CMAKE_COMPILER_IS_GNUCC)