X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=CMakeLists.txt;h=c61c483368afe83aa47486aac76385bfe67eea26;hb=6ca245e1d26401609f4811e90ffed40a09cb51bd;hp=e4254d66ff5e06f8d96bac2d492ccdcb476c24f4;hpb=3f472567bdd9bc3fbfd99b342ee29b25d5b553be;p=rrq%2Ffuse_xattrs.git diff --git a/CMakeLists.txt b/CMakeLists.txt index e4254d6..c61c483 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,31 +1,69 @@ -cmake_minimum_required(VERSION 3.6) -project(fuse_xattrs) +cmake_minimum_required(VERSION 2.8 FATAL_ERROR) +project(fuse_xattrs C) -include (CheckIncludeFileCXX) -check_include_file_cxx (attr/xattr.h HAVE_ATTR_XATTR_H) -check_include_file_cxx (sys/xattr.h HAVE_SYS_XATTR_H) +set(FUSE_XATTRS_VERSION_MAJOR 0) +set(FUSE_XATTRS_VERSION_MINOR 3) -# Check if xattr functions take extra argument. -include (CheckCXXSourceCompiles) -CHECK_CXX_SOURCE_COMPILES ("#include - #include - int main() { getxattr(0,0,0,0,0,0); return 1; } " XATTR_ADD_OPT) +set(BINARY_SIDECAR_EXT \".xattr\") +set(MAX_METADATA_SIZE "8*1024*1024") # 8 MiB +set(XATTR_NAME_MAX 255) # chars in an extended attribute name +set(XATTR_SIZE_MAX 65536) # size of an extended attribute value (64k) +set(XATTR_LIST_MAX 65536) # size of extended attribute namelist (64k) + +configure_file ( + "${PROJECT_SOURCE_DIR}/fuse_xattrs_config.h.in" + "${PROJECT_BINARY_DIR}/fuse_xattrs_config.h" +) +include_directories( + "${PROJECT_BINARY_DIR}" +) + +configure_file ( + "${PROJECT_SOURCE_DIR}/fuse_xattrs.1.in" + "${PROJECT_BINARY_DIR}/fuse_xattrs.1" +) + +# Check xattr headers +include (CheckIncludeFile) +check_include_file (sys/xattr.h HAVE_SYS_XATTR_H) +if(NOT HAVE_SYS_XATTR_H) + message(FATAL_ERROR "sys/xattr.h not found") +endif() + +include (CheckCSourceCompiles) +check_c_source_compiles (" + #include + #include + int main() { return 1; } + " HAVE_ATTR_XATTR_H) +if(NOT HAVE_ATTR_XATTR_H) + message(FATAL_ERROR "attr/xattr.h not found") +endif() + +# set required definitions add_definitions (-D_FILE_OFFSET_BITS=64) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/") + +set(CMAKE_C_FLAGS "-O3") + +option(ENABLE_CODECOVERAGE "Enable code coverage testing support" ) +if(ENABLE_CODECOVERAGE) + include (CodeCoverage) + set(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") + setup_target_for_coverage( + fuse_xattrs_coverage + ./run_tests.sh + coverage + ) +endif(ENABLE_CODECOVERAGE) set(SOURCE_FILES - compat/fuse_opt.c - compat/fuse_opt.h fuse_xattrs.c passthrough.c - passthrough.h binary_storage.c - binary_storage.h utils.c - utils.h - const.h ) add_executable(fuse_xattrs ${SOURCE_FILES}) @@ -36,6 +74,11 @@ target_link_libraries ( ) install (TARGETS fuse_xattrs DESTINATION bin) +install ( + FILES ${CMAKE_CURRENT_BINARY_DIR}/fuse_xattrs.1 + DESTINATION share/man/man1 + COMPONENT doc +) enable_testing() configure_file(run_tests.sh run_tests.sh COPYONLY)