summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2018-08-15 22:46:40 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2018-08-15 23:15:15 +0200
commit0d1ae015fef8e15442dafa61b9c8d929ce467969 (patch)
treea8d56fd12f5c5366e1f6fa3ecc20c78c0202f747 /CMakeLists.txt
parente04f662a42c75cb202684e7254d3b7600e6e1756 (diff)
downloadcc4group-0d1ae015fef8e15442dafa61b9c8d929ce467969.tar.gz
cc4group-0d1ae015fef8e15442dafa61b9c8d929ce467969.zip
Refactor code into a library and implement basic file management methods
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)