[341] | 1 | PROJECT(Orxonox) |
---|
[376] | 2 | #set some global variables, which are used throughout the project |
---|
[341] | 3 | |
---|
[727] | 4 | OPTION(TESTING_ENABLED "Do you want to enable Testing") |
---|
| 5 | IF (TESTING_ENABLED) |
---|
[732] | 6 | ENABLE_TESTING() |
---|
[727] | 7 | ENDIF(TESTING_ENABLED) |
---|
| 8 | |
---|
[732] | 9 | OPTION(NETWORK_TESTING_ENABLED "Do you want to build network testing tools: i.e. chatclient chatserver and alike") |
---|
| 10 | |
---|
[341] | 11 | #Create some verbose output |
---|
| 12 | SET(CMAKE_VERBOSE_MAKEFILE TRUE) |
---|
| 13 | |
---|
[376] | 14 | # set boost search path |
---|
[341] | 15 | SET(Boost_INCLUDE_DIR "/usr/include/boost/") |
---|
| 16 | |
---|
[354] | 17 | # force-set the compile on tardis machines, as default points to g++-3.3 |
---|
[341] | 18 | # only run this test on a lunix/unix machine |
---|
| 19 | IF (UNIX) |
---|
[354] | 20 | |
---|
[341] | 21 | FIND_PROGRAM(UNAME_CMD "uname" |
---|
[354] | 22 | PATHS "/usr/bin /bin") |
---|
[341] | 23 | IF(NOT UNAME_CMD) |
---|
[354] | 24 | MESSAGE("Unable to find uname. Tardis-Check cannot be done.") |
---|
[341] | 25 | ENDIF(NOT UNAME_CMD) |
---|
[354] | 26 | |
---|
| 27 | # run uname -n to get nodename |
---|
[341] | 28 | EXECUTE_PROCESS( |
---|
[354] | 29 | COMMAND "${UNAME_CMD}" "-n" |
---|
| 30 | RESULT_VARIABLE UNAME_RV |
---|
| 31 | ERROR_VARIABLE UNAME_EV |
---|
| 32 | OUTPUT_VARIABLE UNAME_OV) |
---|
[341] | 33 | |
---|
| 34 | IF (NOT "${UNAME_RV}" STREQUAL "0") |
---|
[354] | 35 | MESSAGE("ERROR: uname terminated unclean.") |
---|
[341] | 36 | ENDIF (NOT "${UNAME_RV}" STREQUAL "0") |
---|
[354] | 37 | |
---|
| 38 | # check wheter we are on a tardis machine |
---|
[341] | 39 | IF ("${UNAME_OV}" MATCHES "tardis") |
---|
[735] | 40 | SET (IS_TARDIS ON) |
---|
[341] | 41 | ENDIF ("${UNAME_OV}" MATCHES "tardis") |
---|
[354] | 42 | |
---|
[341] | 43 | # if on tardis change compiler |
---|
[735] | 44 | IF(IS_TARDIS) |
---|
[354] | 45 | MESSAGE("System is a TARDIS: Setting Compiler to g++-4.1.1") |
---|
| 46 | SET(CMAKE_CXX_COMPILER "g++-4.1.1") |
---|
| 47 | # reset eNet serach path |
---|
[466] | 48 | SET(Boost_INCLUDE_DIR "/usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/include") |
---|
[341] | 49 | ENDIF(IS_TARDIS) |
---|
[354] | 50 | |
---|
[341] | 51 | ENDIF (UNIX) |
---|
| 52 | |
---|
[386] | 53 | # pipe $FLAGS to the compiler, and add some local flags. force -O2! |
---|
| 54 | SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O2 -Wall -g -ggdb") |
---|
[571] | 55 | SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O2 -Wall -g -ggdb") |
---|
[386] | 56 | SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}") |
---|
[341] | 57 | |
---|
| 58 | #This sets where to look for "Find*.cmake" files |
---|
| 59 | SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
---|
| 60 | #Performs the search and sets the variables |
---|
| 61 | FIND_PACKAGE(OGRE) |
---|
| 62 | FIND_PACKAGE(OIS) |
---|
[735] | 63 | # FIND_PACKAGE(CEGUI) |
---|
| 64 | # FIND_PACKAGE(CEGUI_OGRE) |
---|
[341] | 65 | FIND_PACKAGE(ENet) |
---|
[735] | 66 | FIND_PACKAGE(Boost REQUIRED thread) |
---|
[389] | 67 | FIND_PACKAGE(OpenAL) |
---|
| 68 | FIND_PACKAGE(ALUT) |
---|
[402] | 69 | FIND_PACKAGE(OggVorbis) |
---|
[539] | 70 | FIND_PACKAGE(ZLIB) |
---|
[341] | 71 | |
---|
[389] | 72 | #Sets the search paths for the linking |
---|
[538] | 73 | LINK_DIRECTORIES(${OGRE_LIB_DIR} ${OIS_LIB_DIR} ${CEGUI_LIB_DIR} ${CEGUI_OGRE_LIB_DIR} ${ENet_LIBRARY} ${Boost_LIBRARY_DIRS} ${Zlib_LIBRARY_DIR} core objects loader network weapon classHierarchy audio) |
---|
[341] | 74 | #Sets the search path for include files |
---|
[538] | 75 | INCLUDE_DIRECTORIES(${OGRE_INCLUDE_DIR} ${OIS_INCLUDE_DIR} ${CEGUI_INCLUDE_DIR} ${CEGUI_OGRE_INCLUDE_DIR} ${ENet_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${OPENAL_INCLUDE_DIR} ${ALUT_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR} ${OGG_INCLUDE_DIR}) |
---|
[341] | 76 | |
---|
| 77 | #add main source dir |
---|
| 78 | ADD_SUBDIRECTORY(src) |
---|