This repository has been archived on 2021-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
uIRCd/CMakeLists.txt

65 lines
1.9 KiB
CMake

cmake_minimum_required(VERSION 3.16)
project(
uIRCd
VERSION 2021.01.24
DESCRIPTION "High performance IRC daemon based on uIRC"
LANGUAGES C
)
set(UIRCD_VERSION "${PROJECT_VERSION}")
add_compile_definitions(UIRCD_VERSION="${UIRCD_VERSION}")
add_compile_definitions(UIRC_HELPERS UIRC_IRCV3)
OPTION(BUILD_LIBCONFIG "Build support for configurations" ON )
OPTION(CODE_ANALYZER "Analyze the code statically" OFF)
OPTION(CODE_COVERAGE "Build with coverage tools" OFF)
add_executable(uircd
src/buffer.c
src/configuration.c
src/connection.c
src/filesystem.c
src/main.c
src/memory.c
src/misc.c
src/signal.c
src/channels.c
)
find_library(UIRC_PATH NAMES uirc REQUIRED)
target_link_libraries(uircd ${UIRC_PATH})
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()
endif()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Werror")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
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")
if (CODE_ANALYZER)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fanalyzer")
endif()
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Weverything -Wno-padded -Wno-disabled-macro-expansion -pedantic")
if (CODE_COVERAGE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-instr-generate -fcoverage-mapping")
endif()
endif()
set_target_properties(uircd PROPERTIES
C_STANDARD 99
VERSION ${UIRCD_VERSION}
)
install(
TARGETS uircd
RUNTIME
)