From 411941baa121bb3e7bc049584b0c75633af9b135 Mon Sep 17 00:00:00 2001 From: Rainer Aue <25301164+raue@users.noreply.github.com> Date: Mon, 12 Feb 2024 08:44:34 +0100 Subject: [PATCH 1/2] Switching to CMake; --- CMakeLists.txt | 16 ++++++++++++++++ example/Makefile | 38 -------------------------------------- 2 files changed, 16 insertions(+), 38 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 example/Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..c500334 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.19.0) + +project(NCOM2CSV) + +if(${CMAKE_SYSTEM_NAME} MATCHES Darwin) + message("Apple OS (Darwin) detected") +elseif(${CMAKE_SYSTEM_NAME} MATCHES Linux) + message("Linux OS detected") +else() + message(FATAL_ERROR "${CMAKE_SYSTEM_NAME} OS detected - currently not supported - EXIT") +endif() + +include_directories(nav) +set(SOURCES nav/NComRxC.c example/NcomToCsv.c) + +add_executable(ncom2csv ${SOURCES}) diff --git a/example/Makefile b/example/Makefile deleted file mode 100644 index 1650dfe..0000000 --- a/example/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -############################################################# -# # -# Make file for the NComToCsv example using the NCOMdecoder # -# # -############################################################# - -#Directories -IDIR =../nav -EXAMPLE_DIR=. - -#Compiler settings -CC =gcc -CFLAGS=-I$(IDIR) -lm - -#NCOMdecoder dependencies -_DEPS = NComRxC.h -DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS)) - -#NCOMdecoder object files required -_OBJ = NComRxC.o -OBJ = $(patsubst %,$(IDIR)/%,$(_OBJ)) - -#Example object files required -_EXAMPLE = NcomToCsv.o -EXAMPLE = $(patsubst %,$(EXAMPLE_DIR)/%,$(_EXAMPLE)) - -#Rule for *library* object files -$(IDIR)/%.o: %.c $(DEPS) - $(CC) -c -o $@ $< $(CFLAGS) - -#Rule for the executable -NComToCsv: $(OBJ) $(EXAMPLE) - gcc -o $@ $^ $(CFLAGS) - -.PHONY: clean - -clean: - rm $(IDIR)/*.o $(EXAMPLE_DIR)/*.o $(EXAMPLE_DIR)/*.exe From 5af45565a05367c43d05c74e88c2c5c82906ac2a Mon Sep 17 00:00:00 2001 From: Rainer Aue <25301164+raue@users.noreply.github.com> Date: Mon, 12 Feb 2024 11:38:56 +0100 Subject: [PATCH 2/2] target_include_directories() i.o. include_directories(); --- CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c500334..ddaebcd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.19.0) -project(NCOM2CSV) +project(ncom2csv) if(${CMAKE_SYSTEM_NAME} MATCHES Darwin) message("Apple OS (Darwin) detected") @@ -10,7 +10,6 @@ else() message(FATAL_ERROR "${CMAKE_SYSTEM_NAME} OS detected - currently not supported - EXIT") endif() -include_directories(nav) set(SOURCES nav/NComRxC.c example/NcomToCsv.c) - -add_executable(ncom2csv ${SOURCES}) +add_executable(${PROJECT_NAME} ${SOURCES}) +target_include_directories(${PROJECT_NAME} PRIVATE nav) \ No newline at end of file