From 95a0a4df59e7dca87034ef19ca0e2c878bd82c9b Mon Sep 17 00:00:00 2001 From: Falk Werner Date: Fri, 15 Feb 2019 16:16:24 +0100 Subject: [PATCH] changed build behavior: tests and example are enabled by default and can be disabled using cmake options --- .travis.yml | 2 +- CMakeLists.txt | 12 ++++++------ README.md | 16 +++++++++++++--- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7ba845a..9ee88f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ before_install: before_script: - mkdir .build - cd .build - - cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_EXAMPLE=ON -DWITH_TESTS=ON .. + - cmake -DCMAKE_BUILD_TYPE=Debug .. script: - make diff --git a/CMakeLists.txt b/CMakeLists.txt index fccff9a..ddc30b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required (VERSION 3.1) project(fuse-wsfs VERSION 0.1.0 DESCRIPTION "Websocket filesystem based on libfuse") -option(WITH_TESTS "enable unit tests" OFF) -option(WITH_EXAMPLE "enable example" OFF) +option(WITHOUT_TESTS "disable unit tests" OFF) +option(WITHOUT_EXAMPLE "disable example" OFF) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) @@ -98,7 +98,7 @@ install(FILES "${PROJECT_BINARY_DIR}/libfuse-wsfs.pc" DESTINATION lib${LIB_SUFFI # app -if(WITH_EXAMPLE) +if(NOT WITHOUT_EXAMPLE) add_executable(wsfs example/main.c @@ -108,11 +108,11 @@ target_link_libraries(wsfs PUBLIC fuse-wsfs ${EXTRA_LIBS}) target_include_directories(wsfs PUBLIC ${EXTRA_INCLUDE_DIRS}) target_compile_options(wsfs PUBLIC ${EXTRA_CFLAGS}) -endif(WITH_EXAMPLE) +endif(NOT WITHOUT_EXAMPLE) # tests -if(WITH_TESTS) +if(NOT WITHOUT_TESTS) pkg_check_modules(GTEST gtest_main) @@ -139,4 +139,4 @@ target_compile_options(alltests PUBLIC ${EXTRA_CFLAGS} ${GTEST_CFLAGS}) enable_testing() add_test(alltests alltests) -endif(WITH_TESTS) \ No newline at end of file +endif(NOT WITHOUT_TESTS) \ No newline at end of file diff --git a/README.md b/README.md index d99191d..902959e 100644 --- a/README.md +++ b/README.md @@ -275,12 +275,22 @@ Read from an open file. To install dependencies, see below. cd fuse-wsfs - mkdir ./build - cd ./build - cmake -DWITH_EXAMPLE=ON .. + mkdir .build + cd .build + cmake .. mkdir test ./wsfs -m test --document_root=../exmaple/www --port=4711 +### Build options + +By default, unit tests and example application are enabled. You can disable them using the following cmake options: + +- **WITHOUT_TESTS**: disable tests + `cmake -DWITHOUT_TESTS=ON ..` + +- **WITHOUT_EXAMPLE**: disable example + `cmake -DWITHOUD_EXAMPLE=ON ..` + ## Dependencies - [libfuse3](https://github.com/libfuse/libfuse/)