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

29 lines
1.1 KiB
CMake
Raw Normal View History

2020-10-17 09:48:34 +00:00
cmake_minimum_required(VERSION 3.16)
project(irc-toolkit LANGUAGES C)
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()
OPTION(CMAKE_BUILD_TYPE "Debug")
if (CMAKE_BUILD_TYPE EQUAL "Debug")
set(COMPILE_OPTIONS "${COMPILE_OPTIONS} -Og")
elseif (CMAKE_BUILD_TYPE EQUAL "Release")
set(COMPILE_OPTIONS "${COMPILE_OPTIONS} -O2 -Werror")
endif()
find_library(UIRC_PATH NAMES uirc libuirc REQUIRED)
2020-10-29 20:12:34 +00:00
macro(buildtool source)
add_executable(${source} ${source}.c common.c)
target_link_libraries(${source} ${UIRC_PATH})
set_property(TARGET ${source} PROPERTY C_STANDARD 99)
install(TARGETS ${source} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endmacro()
buildtool(formatirc)
buildtool(joinpart)