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 | # Reto Grieder, Adrian Friedli |
---|
22 | # Description: |
---|
23 | # Sets the right compiler and linker flags for GCC. |
---|
24 | # |
---|
25 | |
---|
26 | # Also include environment flags. Could cause conflicts though |
---|
27 | SET_COMPILER_FLAGS("$ENV{CXXFLAGS}" CXX CACHE) |
---|
28 | SET_COMPILER_FLAGS("$ENV{CFLAGS}" C CACHE) |
---|
29 | |
---|
30 | # These flags get added to the flags above |
---|
31 | SET_COMPILER_FLAGS(" -g -ggdb -D_DEBUG" Debug CACHE) |
---|
32 | SET_COMPILER_FLAGS(" -DNDEBUG" ReleaseAll CACHE) |
---|
33 | ADD_COMPILER_FLAGS("-O3" Release CACHE) |
---|
34 | ADD_COMPILER_FLAGS("-O2 -g -ggdb" RelWithDebInfo CACHE) |
---|
35 | ADD_COMPILER_FLAGS("-Os" MinSizeRel CACHE) |
---|
36 | |
---|
37 | # CMake doesn't seem to set the PIC flags right on certain 64 bit systems |
---|
38 | IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") |
---|
39 | ADD_COMPILER_FLAGS("-fPIC" CACHE) |
---|
40 | ENDIF() |
---|
41 | |
---|
42 | # Increase warning level if requested |
---|
43 | IF(EXTRA_WARNINGS) |
---|
44 | REMOVE_COMPILER_FLAGS("-Wall" CACHE) |
---|
45 | ADD_COMPILER_FLAGS("-Wextra --Wno-unused-parameter" CACHE) |
---|
46 | ELSE() |
---|
47 | REMOVE_COMPILER_FLAGS("-Wextra --Wno-unused-parameter" CACHE) |
---|
48 | ADD_COMPILER_FLAGS("-Wall" CACHE) |
---|
49 | ENDIF() |
---|
50 | |
---|
51 | # General linker flags |
---|
52 | SET_LINKER_FLAGS("--no-undefined" CACHE) |
---|