summaryrefslogtreecommitdiff
path: root/agbsum/CMakeLists.txt
blob: df89bf3a5be9c39bb74e93fdf2af2b8563d8f153 (plain) (blame)
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
cmake_minimum_required(VERSION 3.21)

set(CMAKE_C_STANDARD 23)

add_executable(
	agbsum

	"src/calc.c"
	"src/chkparams.c"
	"src/exit.c"
	"src/help.c"
	"src/initdat.c"
	"src/main.c"
	"src/open.c"
	"src/pat.c"
	"src/rd.c"
)

target_include_directories(
	agbsum PRIVATE

	"include"
)

target_compile_definitions(
	agbsum PRIVATE

	_FORTIFY_SOURCE=$<IF:$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">,0x0,0x2>
)

if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang|GNU")
	target_compile_options(
		agbsum PRIVATE

		$<IF:$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">,-Og,-Ofast>
		-Wall
		-Wextra
		-Wpedantic
		-fdiagnostics-color=always
		-g
	)
endif()