Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tgidronFS16/cmake/CompilerConfigClang.cmake @ 12202

Last change on this file since 12202 was 11184, checked in by tgidron, 9 years ago

New Pickup + try to create ground from separate tiles

  • Property svn:eol-style set to native
File size: 3.0 KB
Line 
1 #
2 #             ORXONOX - the hottest 3D action shooter ever to exist
3 #                             > www.orxonox.net <
4 #
5 #        This program is free software; you can redistribute it and/or
6 #         modify it under the terms of the GNU General Public License
7 #        as published by the Free Software Foundation; either version 2
8 #            of the License, or (at your option) any later version.
9 #
10 #       This program is distributed in the hope that it will be useful,
11 #        but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #                 GNU General Public License for more details.
14 #
15 #   You should have received a copy of the GNU General Public License along
16 #      with this program; if not, write to the Free Software Foundation,
17 #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 #
19 #
20 #  Author:
21 #    Martin Mueller
22 #  Description:
23 #    Sets the right compiler and linker flags for Clang.
24 #
25
26INCLUDE(FlagUtilities)
27
28# Shortcut for CMAKE_CXX_COMPILER_ID MATCHES Clang
29SET(CMAKE_COMPILER_IS_CLANG TRUE)
30
31# Generate compilation database for clang tooling
32SET(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
33
34SET(PCH_COMPILER_SUPPORT TRUE)
35SET(HAVE_COUNTER_MACRO TRUE)
36
37# Also include environment flags. Could cause conflicts though
38SET_COMPILER_FLAGS("$ENV{CXXFLAGS}" CXX CACHE)
39SET_COMPILER_FLAGS("$ENV{CFLAGS}"   C   CACHE)
40
41# These flags get added to the flags above
42SET_COMPILER_FLAGS("    -g -D_DEBUG" Debug          CACHE)
43SET_COMPILER_FLAGS("       -DNDEBUG" ReleaseAll     CACHE)
44ADD_COMPILER_FLAGS("-O2 -g"          RelForDevs     CACHE)
45ADD_COMPILER_FLAGS("-O3 -g"          RelWithDebInfo CACHE)
46ADD_COMPILER_FLAGS("-O3"             Release        CACHE)
47ADD_COMPILER_FLAGS("-Os"             MinSizeRel     CACHE)
48
49# Introducing c++11
50ADD_COMPILER_FLAGS("-std=c++11" CXX CACHE)
51
52# Never omit frame pointers that could interfere with proper stack traces
53ADD_COMPILER_FLAGS("-fno-omit-frame-pointer" CACHE)
54
55# Enable non standard floating point optimisations
56ADD_COMPILER_FLAGS("-ffast-math" CACHE)
57
58ADD_COMPILER_FLAGS("-DORXONOX_GCC_VISIBILITY -fvisibility=default -fvisibility-inlines-hidden" CACHE)
59
60# We have some unconformant code, disable an optimisation feature
61ADD_COMPILER_FLAGS("-fno-strict-aliasing" CACHE)
62
63# Don't display hundreds of annoying deprecated messages
64ADD_COMPILER_FLAGS("-Wno-deprecated" CXX CACHE)
65
66# Clang doesn't like some narrowing bullet does
67ADD_COMPILER_FLAGS("-Wno-c++11-narrowing" CXX CACHE)
68
69# Always show why a precompiled header file could not be used
70ADD_COMPILER_FLAGS("-Winvalid-pch" CXX CACHE)
71
72# Increase warning level if requested
73IF(EXTRA_COMPILER_WARNINGS)
74  ADD_COMPILER_FLAGS("-Wall -Wextra -Wno-unused-parameter" CACHE)
75ELSE()
76  REMOVE_COMPILER_FLAGS("-Wextra -Wno-unused-parameter" CACHE)
77  ADD_COMPILER_FLAGS("-Wall" CACHE)
78ENDIF()
79
80# Linker flags
81IF(LINUX)
82  # Don't allow undefined symbols in a shared library
83  SET_LINKER_FLAGS("-Wl,--no-undefined" CACHE)
84ENDIF()
Note: See TracBrowser for help on using the repository browser.