| 1 | PROJECT(Orxonox) |
|---|
| 2 | |
|---|
| 3 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) |
|---|
| 4 | |
|---|
| 5 | IF (COMMAND cmake_policy) |
|---|
| 6 | cmake_policy(SET CMP0003 NEW) |
|---|
| 7 | ENDIF (COMMAND cmake_policy) |
|---|
| 8 | |
|---|
| 9 | # Allow for simple IF constructs (makes code a lot more readable) |
|---|
| 10 | #SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) |
|---|
| 11 | |
|---|
| 12 | # This sets where to look for modules (e.g. "Find*.cmake" files) |
|---|
| 13 | SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
|---|
| 14 | |
|---|
| 15 | # Check whether we are on a tardis box and set customized paths |
|---|
| 16 | INCLUDE(CheckTardis) |
|---|
| 17 | |
|---|
| 18 | ############## Testing options ################## |
|---|
| 19 | |
|---|
| 20 | #OPTION(TESTING_ENABLED "Do you want to enable Testing") |
|---|
| 21 | #IF (TESTING_ENABLED) |
|---|
| 22 | # ENABLE_TESTING() |
|---|
| 23 | #ENDIF(TESTING_ENABLED) |
|---|
| 24 | # |
|---|
| 25 | #OPTION (NETWORK_TESTING_ENABLED "Do you want to build network testing tools: i.e. chatclient chatserver and alike") |
|---|
| 26 | #OPTION (NETWORKTRAFFIC_TESTING_ENABLED "Do you want to build dummyserver4 and dummyclient4") |
|---|
| 27 | |
|---|
| 28 | ########## Compiler/Linker options ############## |
|---|
| 29 | |
|---|
| 30 | # Set binary output directories |
|---|
| 31 | SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
|---|
| 32 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
|---|
| 33 | |
|---|
| 34 | # Global compiler/linker flags. |
|---|
| 35 | SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -Wall -Wextra -Wno-unused-parameter -g -ggdb") |
|---|
| 36 | SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -Wall -Wextra -Wno-unused-parameter -g -ggdb") |
|---|
| 37 | #SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O3") |
|---|
| 38 | #SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O3") |
|---|
| 39 | |
|---|
| 40 | SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}") |
|---|
| 41 | SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined") |
|---|
| 42 | SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined") |
|---|
| 43 | SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined") |
|---|
| 44 | |
|---|
| 45 | ############### Library finding ################# |
|---|
| 46 | |
|---|
| 47 | # Uncomment the following line if you want the include and library paths to be shown |
|---|
| 48 | # Alternatively use the "-D VERBOSE_FIND:BOOL=true" option when executing cmake |
|---|
| 49 | |
|---|
| 50 | # SET (VERBOSE_FIND true) |
|---|
| 51 | |
|---|
| 52 | # Set the library directory when using precompiled tarballs for the dependencies under windows |
|---|
| 53 | IF (WIN32) |
|---|
| 54 | IF (MSVC) |
|---|
| 55 | IF ($ENV{ORXONOX_DEV}) |
|---|
| 56 | SET (DEPENDENCY_DIR ${CMAKE_SOURCE_DIR}/../lib_dist/dependencies/) |
|---|
| 57 | ELSE ($ENV{ORXONOX_DEV}) |
|---|
| 58 | SET (DEPENDENCY_DIR ${CMAKE_SOURCE_DIR}/dependencies/) |
|---|
| 59 | ENDIF ($ENV{ORXONOX_DEV}) |
|---|
| 60 | SET(Boost_LIB_SUFFIX_DEBUG vc80-mt-gd-1_35) |
|---|
| 61 | #MESSAGE(STATUS ${DEPENDENCY_DIR}) |
|---|
| 62 | ENDIF (MSVC) |
|---|
| 63 | ENDIF (WIN32) |
|---|
| 64 | |
|---|
| 65 | # Performs the search and sets the variables |
|---|
| 66 | FIND_PACKAGE(OGRE REQUIRED) |
|---|
| 67 | FIND_PACKAGE(CEGUI REQUIRED) |
|---|
| 68 | #FIND_PACKAGE(CEGUI_OGRE REQUIRED) |
|---|
| 69 | FIND_PACKAGE(ENet REQUIRED) |
|---|
| 70 | FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem) |
|---|
| 71 | FIND_PACKAGE(OpenAL REQUIRED) |
|---|
| 72 | FIND_PACKAGE(ALUT REQUIRED) |
|---|
| 73 | FIND_PACKAGE(OggVorbis REQUIRED) |
|---|
| 74 | FIND_PACKAGE(ZLIB REQUIRED) |
|---|
| 75 | FIND_PACKAGE(TCL REQUIRED) |
|---|
| 76 | FIND_PACKAGE(DirectX REQUIRED) |
|---|
| 77 | |
|---|
| 78 | IF(NOT IS_TARDIS) |
|---|
| 79 | FIND_PACKAGE(Lua51 QUIET) |
|---|
| 80 | ENDIF(NOT IS_TARDIS) |
|---|
| 81 | IF(NOT LUA_FOUND) |
|---|
| 82 | FIND_PACKAGE(Lua50 REQUIRED) |
|---|
| 83 | ENDIF(NOT LUA_FOUND) |
|---|
| 84 | |
|---|
| 85 | # Add main source dir |
|---|
| 86 | ADD_SUBDIRECTORY(src) |
|---|