summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt32
1 files changed, 31 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b7bb5cc..47da632 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,36 @@ endif()
find_package(ZLIB REQUIRED)
-add_executable(cc4group main.c)
+set(cc4group_SRC
+ src/cc4group.c
+ src/c4groupheader.c
+ src/c4groupentrycore.c
+)
+
+add_library(cc4group STATIC ${cc4group_SRC})
target_link_libraries(cc4group PRIVATE ZLIB::ZLIB)
target_include_directories(cc4group PRIVATE ZLIB::ZLIB)
+set_property(TARGET cc4group PROPERTY POSITION_INDEPENDENT_CODE ON)
+
+add_library(cc4group_dyn SHARED ${cc4group_SRC})
+target_link_libraries(cc4group_dyn PRIVATE ZLIB::ZLIB)
+target_include_directories(cc4group_dyn PRIVATE ZLIB::ZLIB)
+
+include_directories(src)
+
+function(example name)
+ add_executable(${name} examples/${name}.c)
+ target_link_libraries(${name} PRIVATE cc4group)
+endfunction()
+
+example(unc4group)
+example(c4cat)
+example(c4copy)
+example(c4info)
+example(c4ls)
+example(c4touch)
+example(c4rm)
+example(c4mkdir)
+
+add_executable(c4cat_dyn examples/c4cat_dyn.c)
+target_link_libraries(c4cat_dyn PRIVATE -ldl)