-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
43 lines (35 loc) · 1.11 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 3.0)
set(TARGET_NAME printer)
project(${TARGET_NAME})
add_compile_options(-Wall
-Wextra
-Wno-switch
-Wno-format
-Werror=return-type
-Wfatal-errors)
option(USE_SDL "Build with SDL2" false)
if (USE_SDL)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
add_definitions(-DUSE_SDL)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/*.h)
add_executable(${TARGET_NAME} ${SOURCES})
set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD_REQUIRED 11)
if (USE_SDL)
if (WIN32)
target_link_libraries(${TARGET_NAME} ${MINGW32_LIBRARY}
${SDL2MAIN_LIBRARY}
${SDL2_LIBRARY})
else()
target_link_libraries(${TARGET_NAME} SDL2)
endif()
else()
if (WIN32)
target_link_libraries(${TARGET_NAME} pdcurses)
else()
target_link_libraries(${TARGET_NAME} ncurses)
endif()
endif()