Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/CMakeLists.txt @ 727

Last change on this file since 727 was 727, checked in by bensch, 16 years ago

FICN: Added simple testing facilities to CMake.this is an example of how to implement Testing using CMake.

The Boolean cache-option TESTING_ENABLED can be triggered to enable all tests. Be aware to add all testing subdirectory includes into a IF(TESTING_ENABLED) clause.

File size: 2.6 KB
Line 
1
2PROJECT(Orxonox)
3#set some global variables, which are used throughout the project
4
5OPTION(TESTING_ENABLED "Do you want to enable Testing")
6IF (TESTING_ENABLED)
7ENABLE_TESTING()
8ENDIF(TESTING_ENABLED)
9
10#Create some verbose output
11SET(CMAKE_VERBOSE_MAKEFILE TRUE)
12
13# set boost search path
14SET(Boost_INCLUDE_DIR "/usr/include/boost/")
15
16# force-set the compile on tardis machines, as default points to g++-3.3
17# only run this test on a lunix/unix machine
18IF (UNIX)
19
20  FIND_PROGRAM(UNAME_CMD "uname"
21  PATHS "/usr/bin /bin")
22  IF(NOT UNAME_CMD)
23    MESSAGE("Unable to find uname. Tardis-Check cannot be done.")
24  ENDIF(NOT UNAME_CMD)
25
26  # run uname -n to get nodename
27  EXECUTE_PROCESS(
28  COMMAND "${UNAME_CMD}" "-n"
29  RESULT_VARIABLE UNAME_RV
30  ERROR_VARIABLE UNAME_EV
31  OUTPUT_VARIABLE UNAME_OV)
32
33  IF (NOT "${UNAME_RV}" STREQUAL "0")
34    MESSAGE("ERROR: uname terminated unclean.")
35  ENDIF (NOT "${UNAME_RV}" STREQUAL "0")
36
37  # check wheter we are on a tardis machine
38  IF ("${UNAME_OV}" MATCHES "tardis")
39    SET (IS_TARDIS "tardis")
40  ENDIF ("${UNAME_OV}" MATCHES "tardis")
41
42  # if on tardis change compiler
43  IF (IS_TARDIS)
44    MESSAGE("System is a TARDIS: Setting Compiler to g++-4.1.1")
45    SET(CMAKE_CXX_COMPILER "g++-4.1.1")
46    # reset eNet serach path
47    SET(Boost_INCLUDE_DIR "/usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/include")
48  ENDIF(IS_TARDIS)
49
50ENDIF (UNIX)
51
52# pipe $FLAGS to the compiler, and add some local flags. force -O2!
53#SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O2 -Wall -g -ggdb")
54SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O2 -Wall -g -ggdb")
55#SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O2 -Wall -g -ggdb")
56SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O2 -Wall -g -ggdb")
57SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}")
58
59
60
61#This sets where to look for "Find*.cmake" files
62SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
63#Performs the search and sets the variables
64FIND_PACKAGE(OGRE)
65FIND_PACKAGE(OIS)
66FIND_PACKAGE(CEGUI)
67FIND_PACKAGE(CEGUI_OGRE)
68FIND_PACKAGE(ENet)
69FIND_PACKAGE(Boost)
70FIND_PACKAGE(OpenAL)
71FIND_PACKAGE(ALUT)
72FIND_PACKAGE(OggVorbis)
73FIND_PACKAGE(ZLIB)
74
75#Sets the search paths for the linking
76LINK_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)
77#Sets the search path for include files
78INCLUDE_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})
79
80#add main source dir
81ADD_SUBDIRECTORY(src)
Note: See TracBrowser for help on using the repository browser.