[790] | 1 | PROJECT(Orxonox) |
---|
| 2 | |
---|
[1186] | 3 | cmake_minimum_required(VERSION 2.4) |
---|
| 4 | |
---|
| 5 | if(COMMAND cmake_policy) |
---|
| 6 | cmake_policy(SET CMP0003 NEW) |
---|
| 7 | endif(COMMAND cmake_policy) |
---|
| 8 | |
---|
[1071] | 9 | #This sets where to look for modules (e.g. "Find*.cmake" files) |
---|
| 10 | SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
---|
| 11 | |
---|
| 12 | #Check whether we are on a tardis box |
---|
| 13 | INCLUDE(CheckTardis) |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | ############## Testing options ################## |
---|
| 17 | |
---|
[790] | 18 | OPTION(TESTING_ENABLED "Do you want to enable Testing") |
---|
| 19 | IF (TESTING_ENABLED) |
---|
| 20 | ENABLE_TESTING() |
---|
| 21 | ENDIF(TESTING_ENABLED) |
---|
| 22 | |
---|
| 23 | OPTION(NETWORK_TESTING_ENABLED "Do you want to build network testing tools: i.e. chatclient chatserver and alike") |
---|
| 24 | |
---|
| 25 | |
---|
[1071] | 26 | ########## Compiler/Linker options ############## |
---|
[790] | 27 | |
---|
[1071] | 28 | # if on tardis change compiler and reset boost include directory |
---|
| 29 | IF(IS_TARDIS) |
---|
| 30 | MESSAGE("System is a TARDIS: Setting Compiler to g++-4.1.1") |
---|
| 31 | # force-set the compiler on tardis machines, as default points to g++-3.3 |
---|
| 32 | SET(CMAKE_CXX_COMPILER "g++-4.1.1") |
---|
| 33 | # reset Boost serach path |
---|
| 34 | SET(Boost_INCLUDE_DIR "/usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/include") |
---|
| 35 | ELSE (IS_TARDIS) |
---|
| 36 | SET(Boost_INCLUDE_DIR "/usr/include/boost") |
---|
| 37 | ENDIF(IS_TARDIS) |
---|
[790] | 38 | |
---|
[1071] | 39 | #set binary output directories |
---|
[1133] | 40 | SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) |
---|
| 41 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin/lib) |
---|
[790] | 42 | |
---|
[1071] | 43 | # global compiler/linker flags. force -O2! |
---|
[790] | 44 | SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O2 -Wall -g -ggdb") |
---|
| 45 | SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O2 -Wall -g -ggdb") |
---|
| 46 | SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}") |
---|
[1070] | 47 | SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined") |
---|
| 48 | SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined") |
---|
[1071] | 49 | SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined") |
---|
[790] | 50 | |
---|
[1133] | 51 | #use 'cmake -D make_verb:1 path' to get verbose make output when compiling |
---|
| 52 | IF (MAKE_VERB) |
---|
| 53 | SET(CMAKE_VERBOSE_MAKEFILE TRUE) |
---|
| 54 | ENDIF (MAKE_VERB) |
---|
[1071] | 55 | |
---|
| 56 | |
---|
| 57 | ############### Library finding ################# |
---|
| 58 | |
---|
[790] | 59 | #Performs the search and sets the variables |
---|
| 60 | FIND_PACKAGE(OGRE) |
---|
| 61 | FIND_PACKAGE(OIS) |
---|
| 62 | # FIND_PACKAGE(CEGUI) |
---|
| 63 | # FIND_PACKAGE(CEGUI_OGRE) |
---|
| 64 | FIND_PACKAGE(ENet) |
---|
[1085] | 65 | FIND_PACKAGE(Boost REQUIRED thread) |
---|
[790] | 66 | FIND_PACKAGE(OpenAL) |
---|
| 67 | FIND_PACKAGE(ALUT) |
---|
| 68 | FIND_PACKAGE(OggVorbis) |
---|
[1070] | 69 | FIND_PACKAGE(ZLIB) |
---|
| 70 | FIND_PACKAGE(Lua) |
---|
[1151] | 71 | FIND_PACKAGE(TCL) |
---|
[790] | 72 | |
---|
[1071] | 73 | #Set the search paths for the linking |
---|
[1070] | 74 | LINK_DIRECTORIES( |
---|
| 75 | ${OGRE_LIB_DIR} |
---|
| 76 | ${OIS_LIB_DIR} |
---|
[1071] | 77 | # ${CEGUI_LIB_DIR} ${CEGUI_OGRE_LIB_DIR} |
---|
[1070] | 78 | ${ENet_LIBRARY} |
---|
| 79 | ${Boost_LIBRARY_DIRS} |
---|
| 80 | ${Zlib_LIBRARY_DIR} |
---|
[1151] | 81 | ${TCL_LIBRARY} |
---|
[1070] | 82 | ) |
---|
| 83 | |
---|
[1071] | 84 | #Set the search paths for include files |
---|
[1070] | 85 | INCLUDE_DIRECTORIES( |
---|
| 86 | ${OGRE_INCLUDE_DIR} |
---|
| 87 | ${OIS_INCLUDE_DIR} |
---|
[1071] | 88 | # ${CEGUI_INCLUDE_DIR} ${CEGUI_OGRE_INCLUDE_DIR} |
---|
[1070] | 89 | ${ENet_INCLUDE_DIR} |
---|
| 90 | ${Boost_INCLUDE_DIRS} |
---|
[1115] | 91 | ${OPENAL_INCLUDE_DIR} |
---|
| 92 | ${ALUT_INCLUDE_DIR} |
---|
| 93 | ${VORBIS_INCLUDE_DIR} |
---|
| 94 | ${OGG_INCLUDE_DIR} |
---|
[1070] | 95 | ${Lua_INCLUDE_DIR} |
---|
[1151] | 96 | ${TCL_INCLUDE_PATH} |
---|
[1070] | 97 | ) |
---|
[790] | 98 | |
---|
| 99 | #add main source dir |
---|
| 100 | ADD_SUBDIRECTORY(src) |
---|
[1076] | 101 | |
---|