1 | PROJECT(Orxonox) |
---|
2 | |
---|
3 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) |
---|
4 | |
---|
5 | # TODO: Test CMake Modules without policy |
---|
6 | #IF (COMMAND cmake_policy) |
---|
7 | # cmake_policy(SET CMP0003 NEW) |
---|
8 | #ENDIF (COMMAND cmake_policy) |
---|
9 | |
---|
10 | # This sets where to look for modules (e.g. "Find*.cmake" files) |
---|
11 | SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
---|
12 | |
---|
13 | # Check for special include paths |
---|
14 | INCLUDE(CheckTardis) |
---|
15 | INCLUDE(CheckOrxonoxWinDeps) |
---|
16 | |
---|
17 | ################ Test options ################### |
---|
18 | |
---|
19 | OPTION(ENABLE_TESTS "Enable build tests.") |
---|
20 | IF(ENABLE_TESTS) |
---|
21 | ENABLE_TESTING() |
---|
22 | ENDIF(ENABLE_TESTS) |
---|
23 | |
---|
24 | OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.") |
---|
25 | OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.") |
---|
26 | |
---|
27 | ########## Compiler/Linker options ############## |
---|
28 | |
---|
29 | # Set binary output directories |
---|
30 | SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
---|
31 | SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) |
---|
32 | MARK_AS_ADVANCED(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) |
---|
33 | |
---|
34 | # TODO: use CMake's options for build types |
---|
35 | # Global compiler/linker flags. |
---|
36 | SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -Wall -Wextra -Wno-unused-parameter -g -ggdb") |
---|
37 | SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -Wall -Wextra -Wno-unused-parameter -g -ggdb") |
---|
38 | #SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O3") |
---|
39 | #SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O3") |
---|
40 | |
---|
41 | SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}") |
---|
42 | SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined") |
---|
43 | SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined") |
---|
44 | SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined") |
---|
45 | |
---|
46 | ############### Library finding ################# |
---|
47 | |
---|
48 | # Performs the search and sets the variables |
---|
49 | FIND_PACKAGE(OGRE REQUIRED) |
---|
50 | FIND_PACKAGE(CEGUI REQUIRED) |
---|
51 | # CEGUI_OGRE included in source |
---|
52 | #FIND_PACKAGE(CEGUI_OGRE REQUIRED) |
---|
53 | FIND_PACKAGE(ENet REQUIRED) |
---|
54 | FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem) |
---|
55 | FIND_PACKAGE(OpenAL REQUIRED) |
---|
56 | FIND_PACKAGE(ALUT REQUIRED) |
---|
57 | FIND_PACKAGE(OggVorbis REQUIRED) |
---|
58 | FIND_PACKAGE(ZLIB REQUIRED) |
---|
59 | FIND_PACKAGE(DirectX REQUIRED) |
---|
60 | FIND_PACKAGE(Lua50 REQUIRED) |
---|
61 | #FIND_PACKAGE(Lua51 QUIET) |
---|
62 | |
---|
63 | #don't require the whole tcl rat tail |
---|
64 | FIND_PACKAGE(TCL QUIET) |
---|
65 | IF(NOT TCL_FOUND) |
---|
66 | MESSAGE(FATAL_ERROR "Tcl not found.") |
---|
67 | ENDIF(NOT TCL_FOUND) |
---|
68 | |
---|
69 | # Add main source dir |
---|
70 | ADD_SUBDIRECTORY(src) |
---|
71 | ADD_SUBDIRECTORY(bin) |
---|