aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: caed929dee2546bad774a5d56c2ec046fb0dadf1 (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
43
cmake_minimum_required(VERSION 3.15)
project(STASIS C)
include(GNUInstallDirs)

set(nix_cflags -Wall -Wextra -fPIC -D_GNU_SOURCE)
set(win_cflags /Wall)
set(CMAKE_C_STANDARD 99)
find_package(LibXml2)
find_package(CURL)
link_libraries(CURL::libcurl)
link_libraries(LibXml2::LibXml2)
include_directories(${LIBXML2_INCLUDE_DIR})

option(FORTIFY_SOURCE OFF)
if (FORTIFY_SOURCE)
	set(nix_cflags ${nix_cflags} -O -D_FORTIFY_SOURCE=1)
endif ()

if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
	add_compile_options(${nix_cflags})
elseif (CMAKE_C_COMPILER_ID MATCHES "Clang")
	add_compile_options(${nix_cflags})
elseif (CMAKE_C_COMPILER_ID STREQUAL "MSVC")
	add_compile_options(${win_cflags})
endif()

add_subdirectory(src)

option(BUILD_TESTING_DEBUG OFF)
if (BUILD_TESTING_DEBUG)
	add_compile_options(-DDEBUG)
endif()
option(BUILD_TESTING OFF)
if (BUILD_TESTING)
	enable_testing()
	add_subdirectory(tests)
endif()

set(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/config.h @ONLY)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/stasis_pandoc.css DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/stasis)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/stasis.ini DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/stasis)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mission DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/stasis)