@@ -11,12 +11,14 @@ include(GNUInstallDirs REQUIRED)
1111find_package (PkgConfig REQUIRED)
1212find_package (Threads REQUIRED)
1313find_package (ICU COMPONENTS uc)
14+ find_package (LibXml2 REQUIRED)
1415
15- # pkg_check_modules(DL REQUIRED "libdl" IMPORTED_TARGET)
16- pkg_check_modules(FUSE REQUIRED "fuse>=2.6.0" IMPORTED_TARGET)
17- target_compile_definitions (PkgConfig::FUSE INTERFACE _FILE_OFFSET_BITS=64)
16+ add_compile_definitions (_GNU_SOURCE __CMAKE_BUILD)
1817
19- pkg_check_modules(XML2 REQUIRED "libxml-2.0>=2.6.16" IMPORTED_TARGET)
18+ pkg_check_modules(FUSE REQUIRED "fuse>=2.6.0" IMPORTED_TARGET)
19+ target_compile_definitions (PkgConfig::FUSE INTERFACE
20+ _FILE_OFFSET_BITS=64
21+ )
2022
2123if (APPLE )
2224 pkg_check_modules(UUID REQUIRED "uuid>=1.6" IMPORTED_TARGET)
@@ -25,84 +27,38 @@ else()
2527endif ()
2628
2729add_subdirectory (messages)
28- add_subdirectory (src/libltfs)
2930add_subdirectory (src)
3031
3132
32- # Parsing features options
33- # NOTE: Is this needed? cmake can add this feature using -DUSE_UNORM2
34- # option(ICU_6X "Force to use ICU6x (unorm2) functions" OFF)
35- # if(ICU_6X)
36- # add_definitions(-DUSE_UNORM2)
37- # endif()
38-
39- # option(SNMP "Force to use ICU6x (unorm2) functions" OFF)
33+ option (ENABLE_SNMP "Force to use ICU6x (unorm2) functions" OFF )
4034if (ENABLE_SNMP)
4135 pkg_check_modules(SNMP REQUIRED "net-snmp>=5.3" IMPORTED_TARGET)
42- endif ()
36+ find_program (NETSNMP_CONFIG_BIN net-snmp-config REQUIRED)
37+ if (NETSNMP_CONFIG_BIN)
38+ exec_program (${NETSNMP_CONFIG_BIN} ARGS --cflags OUTPUT_VARIABLE _NETSNMP_CFLAGS)
39+ exec_program (${NETSNMP_CONFIG_BIN} ARGS --libs OUTPUT_VARIABLE _NETSNMP_LIBS)
4340
44- # # Check libraries exists
45- # check_library_exists(pthread pthread_create "" HAVE_PTHREAD)
46- # if(APPLE)
47- # check_library_exists(rt clock_gettime "" HAVE_RT)
48- # endif()
41+ string (REGEX REPLACE "[\"\r\n ]" " " _NETSNMP_CFLAGS "${_NETSNMP_CFLAGS} " )
42+ string (REGEX REPLACE "[\"\r\n ]" " " _NETSNMP_LIBS "${_NETSNMP_LIBS} " )
43+ set (NETSNMP_CFLAGS ${_NETSNMP_CFLAGS} CACHE STRING "CFLAGS for net-snmp lib" )
44+ set (NETSNMP_LIBS ${_NETSNMP_LIBS} CACHE STRING "linker options for net-snmp lib" )
45+ set (NETSNMP_FOUND TRUE CACHE BOOL "net-snmp is found" )
46+ else ()
47+ set (NETSNMP_FOUND FALSE CACHE BOOL "net-snmp is not found" )
48+ endif ()
49+ endif ()
4950
50- # if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
51- # check_library_exists(cam cam_open_device "" HAVE_CAM)
52- # check_library_exists(bsdxml XML_ParserCreate "" HAVE_BSDXML)
53- # check_library_exists(mt mt_status_free "" HAVE_MT)
54- # check_library_exists(execinfo backtrace "" HAVE_EXECINFO)
55- # elseif(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
56- # check_library_exists(execinfo backtrace "" HAVE_EXECINFO)
57- # endif()
5851
59- # # Compilation requirements
60- # # NOTE: Checking for standard headers is really needed?
61- # set(
62- # STD_HEADERS
63- # "fcntl.h"
64- # "limits.h"
65- # "stddef.h"
66- # "stdint.h"
67- # "stdlib.h"
68- # "stdbool.h"
69- # "string.h"
70- # "sys/ioctl.h"
71- # "sys/mount.h"
72- # "sys/time.h"
73- # "termios.h"
74- # "unistd.h"
75- # "sys/sysctl.h"
76- # )
77- # check_include_files("${STD_HEADERS}" HAVE_STD_HEADERS)
7852# check_type_size(mode_t MODE_T)
7953# check_type_size(off_t OFF_T)
8054# check_type_size(size_t SIZE_T)
8155# check_type_size(ssize_t SSIZE_T)
82- # check_type_size(time_t TIME_T)
56+ check_type_size(time_t SIZEOF_TIME_T)
57+ add_compile_definitions (
58+ SIZEOF_TIME_T=${SIZEOF_TIME_T}
59+ )
8360# check_type_size(uint8_t UINT8_T)
8461# check_type_size(uint16_t UINT16_T)
8562# check_type_size(uint32_t UINT32_T)
8663# check_type_size(uint64_t UINT64_T)
8764# check_type_size(uint64_t UINT64_T)
88- # check_symbol_exists(malloc "stdlib.h" HAVE_MALLOC)
89- # check_symbol_exists(strlen "string.h" HAVE_STRLEN)
90- # check_symbol_exists(bzero "string.h" HAVE_BZERO)
91- # check_symbol_exists(memchr "string.h" HAVE_MEMCHR)
92- # check_symbol_exists(memset "string.h" HAVE_MEMSET)
93- # check_symbol_exists(strcasecmp "string.h" HAVE_STRCASECMP)
94- # check_symbol_exists(strdup "string.h" HAVE_STRDUP)
95- # check_symbol_exists(strerror "string.h" HAVE_STRERROR)
96- # check_symbol_exists(strndup "string.h" HAVE_STRNDUP)
97- # check_symbol_exists(strrchr "string.h" HAVE_STRRCHR)
98- # check_symbol_exists(strstr "string.h" HAVE_STRSTR)
99- # check_symbol_exists(mkdir "sys/stat.h" HAVE_MKDIR)
100- # check_symbol_exists(rmdir "unistd.h" HAVE_RMDIR)
101-
102-
103- # check_library_exists(xml2 xmlTextReaderSetup "" HAVE_XML_TEXT_READER_SETUP)
104- # if(HAVE_XML_TEXT_READER_SETUP)
105- # # TODO: Add add macro definitions
106- # endif()
107-
108- # # check_symbol_exists(xmlTextReaderSetup "" HAVE_XML_TEXT_READER_SETUP)
0 commit comments