1 | PROJECT(Tutorial) |
---|
2 | |
---|
3 | #Create some verbose output |
---|
4 | SET(CMAKE_VERBOSE_MAKEFILE TRUE) |
---|
5 | |
---|
6 | #force-set the compile on tardis machines, as default points to g++-3.3 |
---|
7 | # only run this test on a lunix/unix machine |
---|
8 | IF (UNIX) |
---|
9 | FIND_PROGRAM(UNAME_CMD "uname" |
---|
10 | PATHS "/usr/bin /bin") |
---|
11 | IF(NOT UNAME_CMD) |
---|
12 | MESSAGE("Unable to find uname. Tardis-Check cannot be done.") |
---|
13 | ENDIF(NOT UNAME_CMD) |
---|
14 | EXECUTE_PROCESS( |
---|
15 | COMMAND "${UNAME_CMD}" "-n" |
---|
16 | RESULT_VARIABLE UNAME_RV |
---|
17 | ERROR_VARIABLE UNAME_EV |
---|
18 | OUTPUT_VARIABLE UNAME_OV) |
---|
19 | #MESSAGE("Print: UNAME_RV ${UNAME_RV}") |
---|
20 | IF (NOT "${UNAME_RV}" STREQUAL "0") |
---|
21 | MESSAGE("ERROR: uname terminated unclean.") |
---|
22 | ENDIF (NOT "${UNAME_RV}" STREQUAL "0") |
---|
23 | # check wheter we are on a tardis machine |
---|
24 | IF ("${UNAME_OV}" MATCHES "tardis") |
---|
25 | SET (IS_TARDIS "tardis") |
---|
26 | ENDIF ("${UNAME_OV}" MATCHES "tardis") |
---|
27 | # if on tardis change compiler |
---|
28 | IF (IS_TARDIS) |
---|
29 | MESSAGE("System is a TARDIS: Setting Compiler to g++-3.4.3") |
---|
30 | SET(CMAKE_CXX_COMPILER "g++-3.4.3") |
---|
31 | ENDIF(IS_TARDIS) |
---|
32 | ENDIF (UNIX) |
---|
33 | |
---|
34 | # create a few variables to simplify life |
---|
35 | SET(SRC_FILES orxonox.cc) |
---|
36 | SET(INC_FILES ExampleApplication.h ExampleFrameListener.h ExampleLoadingBar.h) |
---|
37 | |
---|
38 | #This sets where to look for "Find*.cmake" files |
---|
39 | SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) |
---|
40 | #Performs the search and sets the variables |
---|
41 | FIND_PACKAGE(OGRE) |
---|
42 | FIND_PACKAGE(OIS) |
---|
43 | |
---|
44 | #Sets the search paths for the linking |
---|
45 | LINK_DIRECTORIES(${OGRE_LIB_DIR} ${OIS_LIB_DIR}) |
---|
46 | #Sets the search path for include files |
---|
47 | INCLUDE_DIRECTORIES(${OGRE_INCLUDE_DIR} ${OIS_INCLUDE_DIR}) |
---|
48 | |
---|
49 | #Creates an executable |
---|
50 | ADD_EXECUTABLE(bin/main ${SRC_FILES} ${INC_FILES}) |
---|
51 | #Links the executable against OGRE and OIS |
---|
52 | TARGET_LINK_LIBRARIES(bin/main ${OGRE_LIBRARIES} ${OIS_LIBRARIES}) |
---|
53 | |
---|