|
| 1 | +cmake_minimum_required(VERSION 3.20) |
| 2 | +project(ltfs, |
| 3 | + VERSION 2.5.0.0 |
| 4 | +) |
| 5 | +include(CheckSymbolExists REQUIRED) |
| 6 | +include(CheckTypeSize REQUIRED) |
| 7 | +include(CheckLibraryExists REQUIRED) |
| 8 | +include(CheckIncludeFiles REQUIRED) |
| 9 | +include(GNUInstallDirs REQUIRED) |
| 10 | + |
| 11 | +find_package(PkgConfig REQUIRED) |
| 12 | +find_package(Threads REQUIRED) |
| 13 | +find_package(ICU COMPONENTS uc) |
| 14 | + |
| 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) |
| 18 | + |
| 19 | +pkg_check_modules(XML2 REQUIRED "libxml-2.0>=2.6.16" IMPORTED_TARGET) |
| 20 | + |
| 21 | +if(APPLE) |
| 22 | + pkg_check_modules(UUID REQUIRED "uuid>=1.6" IMPORTED_TARGET) |
| 23 | +else() |
| 24 | + pkg_check_modules(UUID REQUIRED "uuid>=1.36" IMPORTED_TARGET) |
| 25 | +endif() |
| 26 | + |
| 27 | +add_subdirectory(messages) |
| 28 | +add_subdirectory(src/libltfs) |
| 29 | +add_subdirectory(src) |
| 30 | + |
| 31 | + |
| 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) |
| 40 | +if(ENABLE_SNMP) |
| 41 | + pkg_check_modules(SNMP REQUIRED "net-snmp>=5.3" IMPORTED_TARGET) |
| 42 | +endif() |
| 43 | + |
| 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() |
| 49 | + |
| 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() |
| 58 | + |
| 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) |
| 78 | +# check_type_size(mode_t MODE_T) |
| 79 | +# check_type_size(off_t OFF_T) |
| 80 | +# check_type_size(size_t SIZE_T) |
| 81 | +# check_type_size(ssize_t SSIZE_T) |
| 82 | +# check_type_size(time_t TIME_T) |
| 83 | +# check_type_size(uint8_t UINT8_T) |
| 84 | +# check_type_size(uint16_t UINT16_T) |
| 85 | +# check_type_size(uint32_t UINT32_T) |
| 86 | +# check_type_size(uint64_t UINT64_T) |
| 87 | +# 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