-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
43 lines (32 loc) · 1.2 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.1...3.10)
project(jarm VERSION 0.0
DESCRIPTION "Just another random Minesweeper")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
# First line activates more Warnings
set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic \
-fsanitize=address -g3 -D_FORTIFY_SOURCE=2 \
-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector \
-fstack-protector-all -g -pipe -D_REENTRANT")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})
set(psd ${PROJECT_SOURCE_DIR})
set(cd ${psd})
# Generate cli library
set(cd ${psd}/src/cli)
set(cli ${cd}/Cli.c)
add_library(cli "${cli}")
# Generate logic library
set(cd ${psd}/src/logic)
set(log ${cd}/GameLogic.c)
add_library(log "${log}")
# Generate executable with linkage to libraries
set(libs cli
log)
IF (NOT WIN32)
set(libs ${libs} m) # "m" is needed to link to libm (math.h)
# but windows does linking to math automatically
# so we don't need math.h here
ENDIF()
add_executable(prog.out src/main.c)
target_link_libraries(prog.out PUBLIC ${libs})