Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/buildsystem/CMakeLists.txt @ 2398

Last change on this file since 2398 was 2359, checked in by adrfried, 16 years ago

small cmake cleanup

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