-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
37 lines (31 loc) · 938 Bytes
/
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
cmake_minimum_required(VERSION 2.8.11)
project(euler)
option(OVERDRIVE "Enable platform-specific optimizations" ON)
option(SHERLOCK "Enable expensive debug checks" OFF)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
if(${OVERDRIVE})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
endif()
if(${SHERLOCK})
add_definitions(-DAE_FLTDEBUG)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -ffast-math")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=return-type")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=switch-enum")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FORTIFY_SOURCE=2")
endif()
add_executable(euler
main.c
misc/terminal.c
misc/file.c
misc/rng.c
misc/debug.c
misc/time.c
)
target_include_directories(euler PRIVATE .)
target_link_libraries(euler m)