diff --git a/CMakeLists.txt b/CMakeLists.txt index 67008eb..e5553de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,13 @@ cmake_minimum_required(VERSION 3.5) project(onus VERSION 0.1 LANGUAGES C) option(BUILD_SHARED_LIBS "Build using shared libraries" ON) +option(ONUS_BUILD_EXAMPLES "Build examples" OFF) set(CMAKE_C_STANDARD 90) add_subdirectory(pkg/common) -add_subdirectory(pkg/fs) \ No newline at end of file +add_subdirectory(pkg/fs) + +if(ONUS_BUILD_EXAMPLES) +add_subdirectory(examples/cache) +endif() \ No newline at end of file diff --git a/examples/cache/CMakeLists.txt b/examples/cache/CMakeLists.txt new file mode 100644 index 0000000..d94fae6 --- /dev/null +++ b/examples/cache/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(test_cache) +target_sources(test_cache PRIVATE src/main.c) +target_link_libraries(test_cache PRIVATE onus::fs) \ No newline at end of file diff --git a/examples/cache/src/main.c b/examples/cache/src/main.c new file mode 100644 index 0000000..657fb8e --- /dev/null +++ b/examples/cache/src/main.c @@ -0,0 +1,12 @@ +#include +#include +#include +#include "onus/fs.h" + +int main() { + char tmp[PATH_MAX]; + int status = onus_fs_make_tmp(tmp, sizeof(tmp), NULL); + printf("Got status: %d. Path: %s\n", status, tmp); + // onus_fs_del_tmp(tmp); + return 0; +} \ No newline at end of file