forked from JodyAndrews/SDL2_Basic_Setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
89 lines (65 loc) · 2.51 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
86
cmake_minimum_required(VERSION 3.13.1)
Message("")
Message( STATUS "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR} )
Message( STATUS "CMAKE_SOURCE_DIR: " ${CMAKE_SOURCE_DIR} )
Message( STATUS "CMAKE_COMMAND: " ${CMAKE_COMMAND} )
Message( STATUS "CMAKE_VERSION: " ${CMAKE_VERSION} )
Message( STATUS "CMAKE_C_COMPILER: " ${CMAKE_C_COMPILER} )
Message( STATUS "CMAKE_PROJECT_NAME: " ${CMAKE_PROJECT_NAME} )
Message( STATUS "CMAKE_FINDCMAKE: " ${CMAKE_SOURCE_DIR}/CMAKE )
project(SDL2_Basic_Setup)
# ------- Set Vars ------- #
set(CMAKE_C_STANDARD 11)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMAKE")
set(SOURCE_FILES src/main.c)
Message("")
Message( STATUS "SOURCE entry point : " ${SOURCE_FILES} )
Message("")
# ------- End Set Vars --- #
# ------- Executable ----- #
ADD_EXECUTABLE(SDL2_Basic_Setup ${SOURCE_FILES})
# ------- End Executable - #
# ------- Finds ---------- #
FIND_PACKAGE(SDL2 REQUIRED)
Message("")
Message( STATUS "FINDING SDL2" )
IF (${SDL2_FOUND})
Message( STATUS "SDL2_FOUND: " ${SDL2_FOUND})
Message( STATUS "SDL2_INCLUDE_DIR:" ${SDL2_INCLUDE_DIR})
Message( STATUS "SDL2_LIBRARY: " ${SDL2_LIBRARY})
ELSE()
Message( STATUS "SDL2_FOUND: " ${SDL2_FOUND})
Message( FATAL_ERROR "SDL2 NOT FOUND" )
ENDIF()
FIND_PACKAGE(SDL2_IMAGE)
Message("")
Message( STATUS "FINDING SDL2_IMAGE" )
Message( STATUS "SDL2_IMAGE_FOUND: " ${SDL2_IMAGE_FOUND})
IF (${SDL2_IMAGE_FOUND})
Message( STATUS "SDL2_IMAGE_INCLUDE_DIR: " ${SDL2_IMAGE_INCLUDE_DIR})
Message( STATUS "SDL2_IMAGE_LIBRARY: " ${SDL2_IMAGE_LIBRARY})
ELSE()
Message( FATAL_ERROR "SDL2_IMAGE NOT FOUND" )
ENDIF()
FIND_PACKAGE(SDL2TTF)
Message("")
Message( STATUS "FINDING SDL2TTF" )
Message( STATUS "SDL2TTF_FOUND: " ${SDL2TTF_FOUND} )
IF (${SDL2TTF_FOUND})
Message( STATUS "SDL2TTF_INCLUDE_DIR: " ${SDL2TTF_INCLUDE_DIR})
Message( STATUS "SDL2TTF_LIBRARY: " ${SDL2TTF_LIBRARY})
ELSE()
Message( FATAL_ERROR "SDL2TTF NOT FOUND" )
ENDIF()
Message("")
FIND_PACKAGE(SDL2Mixer)
Message( STATUS "FINDING SDL2Mixer" )
Message( STATUS "SDL2Mixer_FOUND: " ${SDL2Mixer_FOUND} )
Message("")
file(COPY resources DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
# ------- End Finds ------ #
# ------- Inc & Link ---- #
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR} ${SDL2TTF_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIR} ${SDL2Mixer_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARY} ${SDL2TTF_LIBRARY} ${SDL2_IMAGE_LIBRARY} ${SDL2Mixer_LIBRARY} )
# ------- End ----------- #