ref: 40945bfd80c7fe42fa7d34bed29f8f1cd9d55cf8 shayla/CMakeLists.txt -rw-r--r-- 1.9 KiB View raw
                                                                                
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
cmake_minimum_required(VERSION 3.4)
project(shayla)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
    message (FATAL_ERROR "Don't use 'cmake .' Create a build folder first")
endif (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)

add_compile_options("-Wall;-Wextra;-Werror;-Wno-unused-parameter;-Wno-unused-result;-O3;-g")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions") # Enable table-based thread cancellation
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector") # Compile / Run time stack protection
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe") # Avoid temporary files, speeding up builds
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FORTIFY_SOURCE=2") # Run-time buffer overflow detection
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=format-security") # Reject potentially unsafe format string arguents
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunreachable-code") # Warn if the compiler detects that code will never be executed
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wswitch-enum") # Force a switch on an enum to have all the cases possible

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)

#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -g")

add_subdirectory(defs/git)
generate_git_c_version(version.c)

include_directories(".")
include_directories("./sundown/src")
include_directories("./sundown/html")

link_libraries(pthread)

add_executable(shayla main.c
    args.c
    file.c
    posts.c
    header.c
    log.c
    list.c
    dir.c
    pool.c
    shtml.c
    rss.c
    version.c
    ./sundown/src/autolink.c
    ./sundown/src/buffer.c
    ./sundown/src/markdown.c
    ./sundown/html/html.c
    ./sundown/html/html_smartypants.c
    ./sundown/html/houdini_href_e.c
    ./sundown/html/houdini_html_e.c
    ./sundown/src/stack.c
)
install(TARGETS shayla DESTINATION bin)