use larger string heap
[rrq/fuse_xattrs.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
2 project(fuse_xattrs C)
3
4 set(FUSE_XATTRS_VERSION_MAJOR 0)
5 set(FUSE_XATTRS_VERSION_MINOR 5)
6
7 set(BINARY_SIDECAR_EXT \".xattr\")
8
9 set(MAX_METADATA_SIZE "8*1024*1024")  # 8 MiB
10 set(XATTR_NAME_MAX 255)               # chars in an extended attribute name
11 set(XATTR_SIZE_MAX 65536)             # size of an extended attribute value (64k)
12 set(XATTR_LIST_MAX 65536)             # size of extended attribute namelist (64k)
13
14 configure_file (
15         "${PROJECT_SOURCE_DIR}/fuse_xattrs_config.h.in"
16         "${PROJECT_BINARY_DIR}/fuse_xattrs_config.h"
17 )
18 include_directories(
19         "${PROJECT_BINARY_DIR}"
20 )
21
22 configure_file (
23         "${PROJECT_SOURCE_DIR}/fuse_xattrs.1.in"
24         "${PROJECT_BINARY_DIR}/fuse_xattrs.1"
25 )
26
27 # Check xattr headers
28 include (CheckIncludeFile)
29 check_include_file (sys/xattr.h HAVE_SYS_XATTR_H)
30 if(NOT HAVE_SYS_XATTR_H)
31     message(FATAL_ERROR "sys/xattr.h not found")
32 endif()
33
34 include (CheckCSourceCompiles)
35 check_c_source_compiles ("
36   #include <sys/types.h>
37   #include <sys/xattr.h>
38   int main() { return 1; }
39   " HAVE_SYS_XATTR_H)
40 if(NOT HAVE_SYS_XATTR_H)
41     message(FATAL_ERROR "sys/xattr.h not found")
42 endif()
43
44 # set required definitions
45 add_definitions (-D_FILE_OFFSET_BITS=64)
46 add_definitions (-D HAVE_UTIMENSAT=1)
47 #add_definitions (-D DEBUG=1)
48
49 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
50
51 set(CMAKE_C_FLAGS "-O3")
52 #set(CMAKE_C_FLAGS "-g -Wall")
53
54 option(ENABLE_CODECOVERAGE "Enable code coverage testing support" )
55 if(ENABLE_CODECOVERAGE)
56     include (CodeCoverage)
57     set(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
58     setup_target_for_coverage(
59             fuse_xattrs_coverage
60             ./run_tests.sh
61             coverage
62     )
63 endif(ENABLE_CODECOVERAGE)
64
65 set(SOURCE_FILES
66         stringmem.c
67         fuse_xattrs.c
68         passthrough.c
69         binary_storage.c
70         utils.c
71 )
72
73 add_executable(fuse_xattrs ${SOURCE_FILES})
74
75 if(APPLE)
76     target_link_libraries (
77             fuse_xattrs
78             osxfuse
79     )
80 else()
81     target_link_libraries (
82             fuse_xattrs
83             fuse
84     )
85 endif()
86
87
88 install (TARGETS fuse_xattrs DESTINATION bin)
89 install (
90         FILES ${CMAKE_CURRENT_BINARY_DIR}/fuse_xattrs.1
91         DESTINATION share/man/man1
92         COMPONENT doc
93 )
94
95 enable_testing()
96 configure_file(run_tests.sh run_tests.sh COPYONLY)
97 configure_file(test/tests.py test/tests.py COPYONLY)
98 add_test(NAME integration
99         COMMAND run_tests.sh)