Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/buildsystem2/CMakeLists.txt @ 2560

Last change on this file since 2560 was 2526, checked in by rgrieder, 16 years ago

Reenabled -fPIC flag, but only for non MINGW boxes because MinGW will otherwise issue a waring for every source file.

  • Property svn:eol-style set to native
File size: 2.9 KB
Line 
1PROJECT(Orxonox)
2
3CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
4
5# This sets where to look for modules (e.g. "Find*.cmake" files)
6SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
7
8# Check for special include paths
9INCLUDE(CheckTardis)
10INCLUDE(CheckOrxonoxWinDeps)
11
12################ Test options ###################
13
14OPTION(ENABLE_TESTS "Enable build tests.")
15IF(ENABLE_TESTS)
16  ENABLE_TESTING()
17ENDIF(ENABLE_TESTS)
18
19OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.")
20OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.")
21
22########## Compiler/Linker options ##############
23
24# Set binary output directories
25SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
26SET(LIBRARY_OUTPUT_PATH    ${PROJECT_BINARY_DIR}/bin)
27MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
28
29# Compiler/Linker flags.
30IF(NOT CMAKE_BUILD_TYPE)
31  SET(CMAKE_BUILD_TYPE "Debug")
32ENDIF(NOT CMAKE_BUILD_TYPE)
33#SET(CMAKE_C_FLAGS   "$ENV{CFLAGS}   -Wall -Wextra -Wno-unused-parameter")
34SET(CMAKE_C_FLAGS   "$ENV{CFLAGS}   -Wall ${ORXONOX_FPIC_FLAG}")
35#SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -Wall -Wextra -Wno-unused-parameter")
36SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -Wall ${ORXONOX_FPIC_FLAG}")
37SET(CMAKE_C_FLAGS_DEBUG            "-g -ggdb")
38SET(CMAKE_CXX_FLAGS_DEBUG          "-g -ggdb")
39SET(CMAKE_C_FLAGS_RELEASE          "-O3 -DNDEBUG")
40SET(CMAKE_CXX_FLAGS_RELEASE        "-O3 -DNDEBUG")
41SET(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -DNDEBUG -g -ggdb")
42SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -DNDEBUG -g -ggdb")
43SET(CMAKE_C_FLAGS_MINSIZEREL       "-Os -DNDEBUG")
44SET(CMAKE_CXX_FLAGS_MINSIZEREL     "-Os -DNDEBUG")
45
46SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}")
47SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined")
48SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined")
49SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined")
50
51############### Library finding #################
52
53# Performs the search and sets the variables
54FIND_PACKAGE(OGRE REQUIRED)
55FIND_PACKAGE(CEGUI REQUIRED)
56# CEGUI_OGRE is already included in source
57#FIND_PACKAGE(CEGUI_OGRE REQUIRED)
58FIND_PACKAGE(ENet REQUIRED)
59FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem)
60FIND_PACKAGE(OpenAL REQUIRED)
61FIND_PACKAGE(ALUT REQUIRED)
62FIND_PACKAGE(OggVorbis REQUIRED)
63FIND_PACKAGE(ZLIB REQUIRED)
64FIND_PACKAGE(DirectX REQUIRED)
65
66# Require Lua 5.0 or 5.1
67FIND_PACKAGE(Lua50 QUIET)
68IF(NOT LUA50_FOUND)
69    # Remove variables set by Lua50 and try with Lua51
70    SET(LUA_INCLUDE_DIR)
71    SET(LUA_LIBRARY_lua)
72    SET(LUA_LIBRARY_lualib)
73    SET(LUA_LIBRARIES)
74    FIND_PACKAGE(Lua51 REQUIRED)
75ENDIF(NOT LUA50_FOUND)
76# Determine Lua version (Lua50 may also find Lua51)
77FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" LUA_VERSION REGEX "LUA_VERSION")
78STRING(REGEX REPLACE "^.*\"Lua (.*)\".*$" "\\1" LUA_VERSION "${LUA_VERSION}")
79
80# Don't require the whole tcl rat tail
81FIND_PACKAGE(TCL QUIET)
82IF(NOT TCL_FOUND)
83    MESSAGE(FATAL_ERROR "Tcl not found.")
84ENDIF(NOT TCL_FOUND)
85
86# Add main source dir
87ADD_SUBDIRECTORY(src)
88ADD_SUBDIRECTORY(bin)
Note: See TracBrowser for help on using the repository browser.