[1505] | 1 | PROJECT(Orxonox) |
---|
| 2 | |
---|
[1981] | 3 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) |
---|
[1505] | 4 | |
---|
[1776] | 5 | IF (COMMAND cmake_policy) |
---|
[1505] | 6 | cmake_policy(SET CMP0003 NEW) |
---|
[1776] | 7 | ENDIF (COMMAND cmake_policy) |
---|
[1505] | 8 | |
---|
[1872] | 9 | # Allow for simple IF constructs (makes code a lot more readable) |
---|
| 10 | #SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) |
---|
| 11 | |
---|
[1776] | 12 | # This sets where to look for modules (e.g. "Find*.cmake" files) |
---|
[1505] | 13 | SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
---|
| 14 | |
---|
[1977] | 15 | # Check whether we are on a tardis box and set customized paths |
---|
[1505] | 16 | INCLUDE(CheckTardis) |
---|
| 17 | |
---|
| 18 | ############## Testing options ################## |
---|
| 19 | |
---|
[1977] | 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") |
---|
[1505] | 27 | |
---|
| 28 | ########## Compiler/Linker options ############## |
---|
| 29 | |
---|
[1776] | 30 | # Set binary output directories |
---|
[1882] | 31 | SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
---|
[1977] | 32 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
---|
[1505] | 33 | |
---|
[1977] | 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") |
---|
[1505] | 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 | |
---|
[1776] | 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 | |
---|
[1872] | 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) |
---|
[1977] | 61 | #MESSAGE(STATUS ${DEPENDENCY_DIR}) |
---|
[1872] | 62 | ENDIF (MSVC) |
---|
| 63 | ENDIF (WIN32) |
---|
| 64 | |
---|
[1776] | 65 | # Performs the search and sets the variables |
---|
[1977] | 66 | FIND_PACKAGE(OGRE REQUIRED) |
---|
| 67 | FIND_PACKAGE(CEGUI REQUIRED) |
---|
[1999] | 68 | # CEGUI_OGRE included in source |
---|
[1977] | 69 | #FIND_PACKAGE(CEGUI_OGRE REQUIRED) |
---|
| 70 | FIND_PACKAGE(ENet REQUIRED) |
---|
[1981] | 71 | FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem) |
---|
[1977] | 72 | FIND_PACKAGE(OpenAL REQUIRED) |
---|
| 73 | FIND_PACKAGE(ALUT REQUIRED) |
---|
| 74 | FIND_PACKAGE(OggVorbis REQUIRED) |
---|
| 75 | FIND_PACKAGE(ZLIB REQUIRED) |
---|
| 76 | FIND_PACKAGE(TCL REQUIRED) |
---|
| 77 | FIND_PACKAGE(DirectX REQUIRED) |
---|
[1999] | 78 | FIND_PACKAGE(Lua50 REQUIRED) |
---|
| 79 | #FIND_PACKAGE(Lua51 QUIET) |
---|
[1505] | 80 | |
---|
[1776] | 81 | # Add main source dir |
---|
[1505] | 82 | ADD_SUBDIRECTORY(src) |
---|