aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: f5d6b44c0115951469dbbf59c922659fd65fa3d0 (plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
cmake_minimum_required(VERSION 3.21)

include(FetchContent)
FetchContent_Declare(
  discount
  GIT_REPOSITORY "https://github.com/Orc/discount"
  GIT_TAG "main"
  SOURCE_DIR "discount"
)
FetchContent_MakeAvailable(discount)

add_subdirectory(${discount_SOURCE_DIR}/cmake)

project(msg C)

set(SRC
  src/config.c
  src/copy.c
  src/engine/contentfor.c
  src/engine/eachdo.c
  src/engine/engine.c
  src/engine/include.c
  src/filehandler.c
  src/lexer.c
  src/list.c
  src/main.c
  src/msg.c
  src/template.c
  src/util.c
)

set(C_COMPILE_OPTIONS
  # -O3
  # -O0

  -Wall
  -Wextra
  # -Werror

  -g3
  -glldb

  -std=c99

  -Wno-unused-result
  -Wno-unused-variable
)

add_executable(msg ${SRC})
target_include_directories(msg PRIVATE include)

target_include_directories(msg PRIVATE discount)
target_link_libraries(msg libmarkdown)

# The compiler isn't very happy with discount
target_compile_options(libmarkdown PRIVATE -w)
target_compile_options(mkd2html PRIVATE -w)
target_compile_options(makepage PRIVATE -w)
target_compile_options(markdown PRIVATE -w)
target_compile_options(common PRIVATE -w)

target_compile_options(msg PRIVATE
  $<$<COMPILE_LANGUAGE:C>: ${C_COMPILE_OPTIONS}>
)

install(TARGETS msg)