2020-07-17 13:47:25 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
project(microircd LANGUAGES C)
|
|
|
|
|
2020-10-02 12:38:11 +00:00
|
|
|
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
|
|
|
add_compile_options(-Wall -Wextra -Wformat-overflow=2 -Wformat-security -Winit-self -Wstrict-overflow=2 -Wstringop-overflow=2 -Walloc-zero -Wduplicated-branches -Wduplicated-cond -Wtrampolines -Wfloat-equal -Wshadow -Wunsafe-loop-optimizations -Wparentheses -pedantic -fanalyzer -fstack-check)
|
|
|
|
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
|
|
add_compile_options(-Weverything -pedantic -Wno-padded -Wno-disabled-macro-expansion)
|
|
|
|
endif()
|
|
|
|
|
2020-07-18 17:37:24 +00:00
|
|
|
if (NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE Debug)
|
|
|
|
endif()
|
2020-10-02 12:38:11 +00:00
|
|
|
|
2020-07-18 17:37:24 +00:00
|
|
|
if (CMAKE_BUILD_TYPE EQUAL "Debug")
|
2020-09-15 14:56:22 +00:00
|
|
|
set(COMPILE_OPTIONS "${COMPILE_OPTIONS} -Og")
|
2020-07-18 17:37:24 +00:00
|
|
|
elseif (CMAKE_BUILD_TYPE EQUAL "Release")
|
2020-09-15 14:56:22 +00:00
|
|
|
set(COMPILE_OPTIONS "${COMPILE_OPTIONS} -O2 -Werror")
|
2020-07-18 17:37:24 +00:00
|
|
|
endif()
|
2020-07-17 13:47:25 +00:00
|
|
|
|
2020-07-25 12:03:18 +00:00
|
|
|
add_executable(uircd
|
|
|
|
src/main.c
|
2020-08-17 20:13:17 +00:00
|
|
|
src/net.c
|
2020-07-25 12:03:18 +00:00
|
|
|
src/filesystem.c
|
|
|
|
src/misc.c
|
|
|
|
)
|
2020-09-15 14:56:22 +00:00
|
|
|
find_library(UIRC_PATH NAMES uirc libuirc REQUIRED)
|
|
|
|
target_link_libraries(uircd ${UIRC_PATH})
|
2020-07-17 13:47:25 +00:00
|
|
|
set_property(TARGET uircd PROPERTY C_STANDARD 99)
|
|
|
|
|
|
|
|
install(TARGETS uircd RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|