2020-07-17 13:47:25 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2021-01-04 18:07:06 +00:00
|
|
|
project(
|
|
|
|
uIRCd
|
|
|
|
VERSION 2021.01.04
|
|
|
|
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}")
|
2020-12-08 22:20:42 +00:00
|
|
|
|
2021-01-04 18:07:06 +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/logging.c
|
|
|
|
src/main.c
|
|
|
|
src/memory.c
|
|
|
|
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")
|
|
|
|
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
|
|
|
|
-fstack-check
|
2021-01-04 18:07:06 +00:00
|
|
|
-pedantic
|
2021-01-02 19:48:00 +00:00
|
|
|
)
|
|
|
|
if (CODE_ANALYZER)
|
|
|
|
add_compile_options(-fanalyzer)
|
|
|
|
endif()
|
|
|
|
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
|
|
add_compile_options(
|
|
|
|
-Weverything
|
|
|
|
-Wno-padded
|
|
|
|
-Wno-disabled-macro-expansion
|
2021-01-04 18:07:06 +00:00
|
|
|
-pedantic
|
2021-01-02 19:48:00 +00:00
|
|
|
)
|
|
|
|
if (CODE_COVERAGE)
|
|
|
|
add_compile_options(-fprofile-instr-generate -fcoverage-mapping)
|
|
|
|
endif()
|
2021-01-03 20:46:04 +00:00
|
|
|
if (CODE_ANALYZER)
|
|
|
|
add_compile_options(--analyze)
|
|
|
|
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
|
|
|
|
)
|