]> git.lizzy.rs Git - nothing.git/blob - CMakeLists.txt
Merge pull request #33 from tsoding/strict-gcc-flags
[nothing.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.2)
2 project(nothing)
3
4 if(WIN32)
5   # Conan integration
6   include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
7   conan_basic_setup()
8 endif()
9
10 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
11
12 find_package(SDL2 REQUIRED)
13
14 include_directories(${SDL2_INCLUDE_DIR})
15
16 set(SOURCE_FILES
17   src/main.c
18   src/player.c
19   src/platforms.c
20   src/rect.c
21   src/point.c
22   src/camera.c
23 )
24
25 set(HEADER_FILES
26   src/player.h
27   src/platforms.h
28   src/rect.h
29   src/point.h
30   src/camera.h
31 )
32
33 add_executable(nothing ${SOURCE_FILES} ${HEADER_FILES})
34 target_link_libraries(nothing ${SDL2_LIBRARY})
35
36 if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "CLANG"))
37   set(CMAKE_C_FLAGS
38     "${CMAKE_C_FLAGS} \
39      -Wall \
40      -Werror \
41      -Wextra \
42      -Wconversion \
43      -Wunused \
44      -Wunused-function \
45      -Wunused-label \
46      -Wunused-macros \
47      -Wunused-parameter \
48      -Wunused-value \
49      -Wunused-variable \
50      -Wcast-align \
51      -Wcast-qual \
52      -Wmissing-declarations \
53      -Wredundant-decls \
54      -Wmissing-prototypes \
55      -Wnested-externs \
56      -Wpointer-arith \
57      -Wshadow \
58      -Wstrict-prototypes \
59      -Wwrite-strings \
60      -fno-common \
61      -pedantic \
62      -std=c11 \
63      -O3")
64   target_link_libraries(nothing m)
65 endif()
66 if(WIN32)
67   target_link_libraries(nothing Imm32 Version winmm)
68 endif()