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