Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 2582 was 2582, checked in by rgrieder, 15 years ago
  • Using dependency directory directly in root dir of a branch as primary folder (./libs resp. ./dependencies) Second priority is ../libs for MinGW and ../lib_dist/vc8/dependencies for msvc.
  • Moved compiler and linker flags to ConfigPlatforms.cmake
  • Solved additional libraries for ENet under MinGW directly in FindEnet.cmake
  • Property svn:eol-style set to native
File size: 2.7 KB
RevLine 
[1505]1PROJECT(Orxonox)
2
[2509]3CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
[1505]4
[2582]5############### Various Options #################
6
7# Keep devs from using the root directory as binary directory (messes up the source tree)
[2574]8IF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
[2582]9  MESSAGE(FATAL_ERROR "Do not use the root directory as CMake output directory! mkdir build; cd build; cmake ..")
[2574]10ENDIF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
11
[1776]12# This sets where to look for modules (e.g. "Find*.cmake" files)
[1505]13SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
14
[2582]15# Set binary output directories
16SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
17SET(LIBRARY_OUTPUT_PATH    ${PROJECT_BINARY_DIR}/bin)
18MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
19
20# Set Debug build to default when not having multi-config generator like msvc
21IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
22  SET(CMAKE_BUILD_TYPE "Debug")
23ENDIF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
24
25############## Platform Config ##################
26
27# Configre platform specific options
[2579]28INCLUDE(ConfigPlatforms)
[1505]29
[2509]30################ Test options ###################
[1505]31
[2509]32OPTION(ENABLE_TESTS "Enable build tests.")
33IF(ENABLE_TESTS)
[1505]34  ENABLE_TESTING()
[2509]35ENDIF(ENABLE_TESTS)
[1505]36
[2509]37OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.")
38OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.")
[1505]39
40############### Library finding #################
41
[2579]42INCLUDE(FindPackageHandleStandardArgs)
43INCLUDE(HandleLibraryTypes)
44
[1776]45# Performs the search and sets the variables
[2509]46FIND_PACKAGE(OGRE REQUIRED)
47FIND_PACKAGE(CEGUI REQUIRED)
48FIND_PACKAGE(ENet REQUIRED)
49FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem)
50FIND_PACKAGE(OpenAL REQUIRED)
51FIND_PACKAGE(ALUT REQUIRED)
52FIND_PACKAGE(OggVorbis REQUIRED)
53FIND_PACKAGE(ZLIB REQUIRED)
54FIND_PACKAGE(DirectX REQUIRED)
[1505]55
[2510]56# Require Lua 5.0 or 5.1
57FIND_PACKAGE(Lua50 QUIET)
58IF(NOT LUA50_FOUND)
59    # Remove variables set by Lua50 and try with Lua51
60    SET(LUA_INCLUDE_DIR)
61    SET(LUA_LIBRARY_lua)
62    SET(LUA_LIBRARY_lualib)
63    SET(LUA_LIBRARIES)
64    FIND_PACKAGE(Lua51 REQUIRED)
65ENDIF(NOT LUA50_FOUND)
66# Determine Lua version (Lua50 may also find Lua51)
67FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" LUA_VERSION REGEX "LUA_VERSION")
68STRING(REGEX REPLACE "^.*\"Lua (.*)\".*$" "\\1" LUA_VERSION "${LUA_VERSION}")
69
[2579]70# QUIET: Don't require the whole tcl rat tail
[2509]71FIND_PACKAGE(TCL QUIET)
72IF(NOT TCL_FOUND)
[2579]73    MESSAGE(FATAL_ERROR "Tcl was not found.")
[2509]74ENDIF(NOT TCL_FOUND)
[1505]75
[2579]76# Hide variables created by CMake FindXX scripts
77MARK_AS_ADVANCED(
78    LUA_LIBRARY_lua
79    LUA_LIBRARY_lualib
80    OPENAL_INCLUDE_DIR
81    OPENAL_LIBRARY
82)
83
[2582]84############### Orxonox Source ##################
85
[1505]86ADD_SUBDIRECTORY(src)
[2509]87ADD_SUBDIRECTORY(bin)
Note: See TracBrowser for help on using the repository browser.