2020-07-17 13:47:25 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2021-01-04 18:07:06 +00:00
|
|
|
project(
|
|
|
|
uIRCd
|
2021-01-24 10:54:06 +00:00
|
|
|
VERSION 2021.01.24
|
2021-01-04 18:07:06 +00:00
|
|
|
DESCRIPTION "High performance IRC daemon based on uIRC"
|
|
|
|
LANGUAGES C
|
|
|
|
)
|
2020-12-30 19:05:03 +00:00
|
|
|
|
2021-01-04 18:07:06 +00:00
|
|
|
set(UIRCD_VERSION "${PROJECT_VERSION}")
|
|
|
|
add_compile_definitions(UIRCD_VERSION="${UIRCD_VERSION}")
|
2021-01-24 10:54:06 +00:00
|
|
|
add_compile_definitions(UIRC_HELPERS UIRC_IRCV3)
|
2020-12-08 22:20:42 +00:00
|
|
|
|
2021-01-12 17:04:21 +00:00
|
|
|
OPTION(BUILD_LIBCONFIG "Build support for configurations" ON )
|
|
|
|
OPTION(CODE_ANALYZER "Analyze the code statically" OFF)
|
|
|
|
OPTION(CODE_COVERAGE "Build with coverage tools" OFF)
|
2020-10-02 12:38:11 +00:00
|
|
|
|
2020-07-25 12:03:18 +00:00
|
|
|
add_executable(uircd
|
2020-12-08 22:20:42 +00:00
|
|
|
src/buffer.c
|
|
|
|
src/configuration.c
|
|
|
|
src/connection.c
|
2020-07-25 12:03:18 +00:00
|
|
|
src/filesystem.c
|
2020-12-08 22:20:42 +00:00
|
|
|
src/main.c
|
|
|
|
src/memory.c
|
2021-01-19 20:35:23 +00:00
|
|
|
src/misc.c
|
2020-12-08 22:20:42 +00:00
|
|
|
src/signal.c
|
2020-12-17 00:27:30 +00:00
|
|
|
src/channels.c
|
2020-07-25 12:03:18 +00:00
|
|
|
)
|
2020-12-08 22:20:42 +00:00
|
|
|
|
|
|
|
find_library(UIRC_PATH NAMES uirc REQUIRED)
|
2021-01-02 19:48:00 +00:00
|
|
|
target_link_libraries(uircd ${UIRC_PATH})
|
|
|
|
|
2021-01-04 18:07:06 +00:00
|
|
|
if(BUILD_LIBCONFIG)
|
|
|
|
find_library(LIBCONFIG_PATH NAMES config)
|
|
|
|
if(NOT LIBCONFIG_PATH)
|
|
|
|
message(WARNING "libconfig not found. uIRCd will not support configuration files")
|
|
|
|
else()
|
|
|
|
message(STATUS "Building with libconfig support")
|
|
|
|
add_compile_definitions(UIRCD_FEATURE_LIBCONFIG)
|
|
|
|
target_link_libraries(uircd ${LIBCONFIG_PATH})
|
|
|
|
endif()
|
2020-12-08 22:20:42 +00:00
|
|
|
endif()
|
2020-07-17 13:47:25 +00:00
|
|
|
|
2021-01-02 19:48:00 +00:00
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Werror")
|
|
|
|
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
2021-01-24 10:54:06 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -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 -fstack-check -pedantic")
|
2021-01-02 19:48:00 +00:00
|
|
|
if (CODE_ANALYZER)
|
2021-01-24 10:54:06 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fanalyzer")
|
2021-01-02 19:48:00 +00:00
|
|
|
endif()
|
|
|
|
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
2021-01-24 10:54:06 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Weverything -Wno-padded -Wno-disabled-macro-expansion -pedantic")
|
2021-01-02 19:48:00 +00:00
|
|
|
if (CODE_COVERAGE)
|
2021-01-24 10:54:06 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
|
2021-01-03 20:46:04 +00:00
|
|
|
endif()
|
2021-01-02 19:48:00 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set_target_properties(uircd PROPERTIES
|
|
|
|
C_STANDARD 99
|
2021-01-04 18:07:06 +00:00
|
|
|
VERSION ${UIRCD_VERSION}
|
2021-01-02 19:48:00 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
install(
|
|
|
|
TARGETS uircd
|
|
|
|
RUNTIME
|
|
|
|
)
|