cmake_minimum_required(VERSION 3.12) project(relaycontrol LANGUAGES C) set(CFLAGS "${CFLAGS} -Wall -Wextra -pedantic -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 -fanalyzer -fstack-protector") if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug) endif() if (CMAKE_BUILD_TYPE EQUAL "Debug") set(CFLAGS "${CFLAGS} -Og") elseif (CMAKE_BUILD_TYPE EQUAL "Release") set(CFLAGS "${CFLAGS} -O2 -Werror") endif() add_executable(relaycntl src/main.c ) set_property(TARGET relaycntl PROPERTY C_STANDARD 99) install(TARGETS relaycntl RUNTIME DESTINATION bin DESTINATION ${CMAKE_INSTALL_BINDIR})