-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
43 lines (30 loc) · 2.06 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(metoritewars)
SET(METORITEWARS_ROOT_PATH ${PROJECT_BINARY_DIR})
SET(METORITEWARS_SOURCE_PATH ${METORITEWARS_ROOT_PATH}/src)
SET(METORITEWARS_TEST_SOURCE_PATH ${METORITEWARS_ROOT_PATH}/test)
SET(METORITEWARS_BIN_PATH ${METORITEWARS_ROOT_PATH}/bin)
SET(METORITEWARS_EXEC_NAME metoritewars)
SET(METORITEWARS_TEST_EXEC_NAME metoritewars_test)
SET(EXECUTABLE_OUTPUT_PATH ${METORITEWARS_BIN_PATH})
FILE(GLOB_RECURSE METORITEWARS_SHARED_SOURCE_FILES ${METORITEWARS_SOURCE_PATH}/*.cpp)
LIST(REMOVE_ITEM METORITEWARS_SHARED_SOURCE_FILES ${METORITEWARS_SOURCE_PATH}/main.cpp)
SET(METORITEWARS_SOURCE_FILES ${METORITEWARS_SOURCE_PATH}/main.cpp)
FILE(GLOB_RECURSE METORITEWARS_TEST_SOURCE_FILES ${METORITEWARS_TEST_SOURCE_PATH}/*.cpp)
SET(METORITEWARS_TEST_SOURCE_FILES ${METORITEWARS_TEST_SOURCE_FILES} ${METORITEWARS_SOURCE_FILES} )
LIST(REMOVE_ITEM METORITEWARS_TEST_SOURCE_FILES ${METORITEWARS_SOURCE_PATH}/main.cpp)
SET(CMAKE_CXX_FLAGS "-g -Wall")
ADD_LIBRARY(base STATIC ${METORITEWARS_SHARED_SOURCE_FILES})
ADD_EXECUTABLE(${METORITEWARS_EXEC_NAME} ${METORITEWARS_SOURCE_FILES})
ADD_EXECUTABLE(${METORITEWARS_TEST_EXEC_NAME} ${METORITEWARS_TEST_SOURCE_FILES})
ADD_CUSTOM_COMMAND(TARGET ${METORITEWARS_TEST_EXEC_NAME} POST_BUILD COMMAND "${METORITEWARS_BIN_PATH}/${METORITEWARS_TEST_EXEC_NAME}")
ADD_CUSTOM_TARGET(tests "${METORITEWARS_BIN_PATH}/${METORITEWARS_TEST_EXEC_NAME}" DEPENDS run_tests COMMENT "Running CPPUNIT tests...")
IF(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
TARGET_LINK_LIBRARIES(${METORITEWARS_EXEC_NAME} base -lIrrlicht -static -lSOIL -lopengl32 -lglu32 -static -lfreeglut -lglaux -lglew32)
TARGET_LINK_LIBRARIES(${METORITEWARS_TEST_EXEC_NAME} base -lIrrlicht -lopengl32 -lglu32 -lfreeglut -lglaux -lglew32 -lcppunit)
ENDIF()
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
TARGET_LINK_LIBRARIES(${METORITEWARS_EXEC_NAME} -lGL base -lIrrlicht -lGLU -lglut -lSDL)
TARGET_LINK_LIBRARIES(${METORITEWARS_TEST_EXEC_NAME} base -lIrrlicht -lGL -lGLU -lglut -lSDL -lcppunit)
ENDIF()
INSTALL(TARGETS ${METORITEWARS_EXEC_NAME} DESTINATION /usr/bin/)