Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 2609 was 2599, checked in by rgrieder, 16 years ago
  • Added orxonox version info. However I don't exactly what the actual is now, so please correct me if I'm wrong.
  • Small changes and fixes
  • Property svn:eol-style set to native
File size: 3.2 KB
RevLine 
[2599]1PROJECT(Orxonox C CXX)
[1505]2
[2509]3CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
[1505]4
[2599]5SET(ORXONOX_VERSION_MAJOR 0)
6SET(ORXONOX_VERSION_MINOR 1)
7SET(ORXONOX_VERSION_PATCH 0)
8SET(ORXONOX_VERSION 0.1.0)
[2582]9
10# Keep devs from using the root directory as binary directory (messes up the source tree)
[2574]11IF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
[2582]12  MESSAGE(FATAL_ERROR "Do not use the root directory as CMake output directory! mkdir build; cd build; cmake ..")
[2574]13ENDIF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
14
[1776]15# This sets where to look for modules (e.g. "Find*.cmake" files)
[2599]16SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
[1505]17
[2582]18# Set binary output directories
[2583]19SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
20SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
21SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
[2582]22
23# Set Debug build to default when not having multi-config generator like msvc
24IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
25  SET(CMAKE_BUILD_TYPE "Debug")
26ENDIF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
27
28############## Platform Config ##################
29
[2583]30# Configure platform specific options
[2579]31INCLUDE(ConfigPlatforms)
[1505]32
[2509]33################ Test options ###################
[1505]34
[2509]35OPTION(ENABLE_TESTS "Enable build tests.")
36IF(ENABLE_TESTS)
[1505]37  ENABLE_TESTING()
[2509]38ENDIF(ENABLE_TESTS)
[1505]39
[2509]40OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.")
41OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.")
[1505]42
43############### Library finding #################
44
[2583]45# Performs the search and sets the variables
[2579]46
[2583]47# Expand the next statement if newer boost versions than 1.36.1 are released
48SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0 CACHE STRING "")
49FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem)
[2588]50# With MSVC, automatic linking is performed for boost. So wee need to tell
51# the linker where to find them. Also note that when running FindBoost for the
52# first time, it will set ${Boost_LIBRARIES} to "" but afterwards to the libs.
53IF (MSVC)
54  LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
55ENDIF (MSVC)
[2509]56FIND_PACKAGE(OGRE REQUIRED)
57FIND_PACKAGE(CEGUI REQUIRED)
58FIND_PACKAGE(ENet REQUIRED)
59FIND_PACKAGE(OpenAL REQUIRED)
60FIND_PACKAGE(ALUT REQUIRED)
61FIND_PACKAGE(OggVorbis REQUIRED)
62FIND_PACKAGE(ZLIB REQUIRED)
63FIND_PACKAGE(DirectX REQUIRED)
[1505]64
[2510]65# Require Lua 5.0 or 5.1
66FIND_PACKAGE(Lua50 QUIET)
67IF(NOT LUA50_FOUND)
[2583]68  # Remove variables set by Lua50 and try with Lua51
69  SET(LUA_INCLUDE_DIR)
70  SET(LUA_LIBRARY_lua)
71  SET(LUA_LIBRARY_lualib)
72  SET(LUA_LIBRARIES)
73  FIND_PACKAGE(Lua51 REQUIRED)
[2510]74ENDIF(NOT LUA50_FOUND)
75# Determine Lua version (Lua50 may also find Lua51)
76FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" LUA_VERSION REGEX "LUA_VERSION")
77STRING(REGEX REPLACE "^.*\"Lua (.*)\".*$" "\\1" LUA_VERSION "${LUA_VERSION}")
78
[2579]79# QUIET: Don't require the whole tcl rat tail
[2509]80FIND_PACKAGE(TCL QUIET)
81IF(NOT TCL_FOUND)
[2583]82  MESSAGE(FATAL_ERROR "Tcl was not found.")
[2509]83ENDIF(NOT TCL_FOUND)
[1505]84
[2579]85# Hide variables created by CMake FindXX scripts
86MARK_AS_ADVANCED(
[2583]87  LUA_LIBRARY_lua
88  LUA_LIBRARY_lualib
89  OPENAL_INCLUDE_DIR
90  OPENAL_LIBRARY
[2579]91)
92
[2582]93############### Orxonox Source ##################
94
[1505]95ADD_SUBDIRECTORY(src)
[2599]96
97# Configure the binary output directory
[2597]98ADD_SUBDIRECTORY(bin-config)
Note: See TracBrowser for help on using the repository browser.