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

set(nix_cflags -Wall -Wextra -fPIC)
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})

if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
	message("gnu options")
	add_compile_options(${nix_cflags})
elseif (CMAKE_C_COMPILER_ID MATCHES "Clang")
	add_compile_options(${nix_cflags})
elseif (CMAKE_C_COMPILER_ID STREQUAL "MSVC")
	message("microsoft visual c options")
	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}/omc.ini DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/omc)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/mission DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/omc)