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