From 163301282383ca02755525c0c04871485bfc175f Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 20 Nov 2022 20:13:37 +0100 Subject: [PATCH] Provide a CMakeLists.txt to use minitar with CMake --- .gitignore | 3 ++- CMakeLists.txt | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore index b6f194b..d9503a3 100644 --- a/.gitignore +++ b/.gitignore @@ -54,4 +54,5 @@ dkms.conf obj/ libmtar.a -.vscode/ \ No newline at end of file +.vscode/ +build/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..454d1f6 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.8..3.22) + +project(minitar C) + +set(SOURCES + src/tar.c + src/util.c +) + +add_library(minitar STATIC ${SOURCES}) + +set_target_properties(minitar PROPERTIES OUTPUT_NAME mtar) + +if (MSVC) + target_compile_options(minitar PRIVATE /W4 /WX) +else() + target_compile_options(minitar PRIVATE -Wall -Wextra -pedantic -Werror) +endif() + +install(TARGETS minitar DESTINATION lib) +install(FILES minitar.h DESTINATION include) \ No newline at end of file