From: Mattia Cabrini Date: Tue, 9 Sep 2025 19:51:31 +0000 (+0200) Subject: Switched to CMake X-Git-Url: https://git.theboydaily.dev/mattia?a=commitdiff_plain;h=cfac6dac8d6998a03f71fb51d84165884e029e2c;p=cmc-find.git Switched to CMake --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d530d57 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +cmc-find +*.swp +*.BAK +*.dSYM +build diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..cecc902 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.16) + +project(cmc-find C) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) +endif() + +set(SRC cmc-find.c) +add_executable(cmc-find ${SRC}) + +target_compile_options(cmc-find PRIVATE + -Wall + -Werror + -Wno-unused-function +) + +target_compile_options(cmc-find PRIVATE + $<$:-O2> + $<$:-g;-O0> +) + +set(INDENT_FLAGS + -nbad -bap -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 + -cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -npsl + -ncs -nsc -sob -ts8 +) + +add_custom_target(fmt + COMMAND indent ${INDENT_FLAGS} ${SRC} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Formatting sources with indent" +) + diff --git a/Makefile b/Makefile deleted file mode 100644 index e47a0f1..0000000 --- a/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -CFLAGS=-Wall -Werror -Wno-unused-function -CFLAGS_REL=$(CFLSGS) -O2 -CFLAGS_DEB=$(CFLAGS) -g -O0 - -SRC=cmc-find.c -BIN=cmc-find - -INDEND_FLAGS=-nbad -bap -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 \ - -cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -npsl \ - -ncs -nsc -sob -ts8 - -all: fmt release - -release: - gcc -o $(BIN) $(SRC) $(CFLAGS_REL) - -debug: - gcc -o $(BIN) $(SRC) $(CFLAGS_DEB) - -fmt: - indent $(INDEND_FLAGS) $(SRC) - -run: # on Unix-like systems... - cat /dev/urandom | ./$(BIN) 1606