This repository has been archived by the owner on Jul 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
85 lines (69 loc) · 2.28 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
cmake_minimum_required(VERSION 3.0.0)
project(Snake2D VERSION 0.1.0)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
#set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake")
set(THREADS_PREFER_PTHREAD_FLAG ON)
include_directories(src)
SET(SNAKE2D_HEADERS
src/BroadCast.h
src/Memory.h
src/Network.h
)
SET(SNAKE2D_SOURCES
src/BroadCast.cpp
src/Memory.cpp
src/main.cpp
src/Network.cpp
)
# mark headers as headers...
SET_SOURCE_FILES_PROPERTIES( ${SNAKE2D_HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE )
# append to sources so that dependency checks work on headers
LIST(APPEND SNAKE2D_SOURCES ${SNAKE2D_HEADERS})
find_package(Threads REQUIRED)
find_package(SDL2 2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIR}) # Maybe DIR on Windows
#include(CTest)
#enable_testing()
#file(GLOB sources "*.cpp" "*.h")
#
#add_executable(Snake2D ${sources})
add_executable(Snake2D ${SNAKE2D_SOURCES})
# OS and compiler checks.
if(UNIX)
MESSAGE("Unix detected")
# linux / normal unix
add_definitions(-DLINUX)
if(CYGWIN)
# Special Cygwin stuff here
elseif(APPLE)
# Special Apple stuff here
remove_definitions(-DLINUX)
add_definitions(-DDARWIN)
endif()
elseif(WIN32)
MESSAGE("Windows detected")
add_definitions(-DWIN32)
SET(PROJECT_LIBS Ws2_32.lib)
if(MINGW)
# Special MINGW stuff here
elseif(MSVC)
# Special MSVC stuff here
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
else()
# No idea what it is, but there's a good chance it's too weird.
MESSAGE( FATAL_ERROR "Using unknown WIN32 compiler... NOT. Please add to build system." )
endif()
endif()
#get_cmake_property(_variableNames VARIABLES)
#list (SORT _variableNames)
#foreach (_variableName ${_variableNames})
# message(STATUS "${_variableName}=${${_variableName}}")
#endforeach()
target_link_libraries(Snake2D ${SDL2_LIBRARY} Threads::Threads ${PROJECT_LIBS}) # SDL2_LIBRARY on WINDOWS?
#configure_file(${PROJECT_SOURCE_DIR}/cmake/Header.h.in ${PROJECT_SOURCE_DIR}/Header.h)
#include(CPack)