-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
79 lines (60 loc) · 2.22 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 17)
project(ZFSWrapper)
################################################################################
# Settings
################################################################################
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
option(ZFSW_BUILD_SHARED_LIBRARY "Build the ZFSWrapper as shared library" OFF)
option(ZFSW_HAS_ZPOOL_STATUS_COMPATIBILITY_ERR "ZFS has symbol ZPOOL_STATUS_COMPATIBILITY_ERR" OFF)
option(ZFSW_HAS_ZPOOL_STATUS_INCOMPATIBLE_FEAT "ZFS has symbol ZPOOL_STATUS_INCOMPATIBLE_FEAT" OFF)
################################################################################
# Dependencies
################################################################################
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
find_package(ZFS REQUIRED)
################################################################################
# Library
################################################################################
set(ZFS_WRAPPER_SOURCES
include/ZFSNVList.hpp
include/ZFSStrings.hpp
include/ZFSUtils.hpp
src/ZFSNVList.cpp
src/ZFSStrings.cpp
src/ZFSUtils.cpp
)
if(ZFSW_BUILD_SHARED_LIBRARY)
set(ZFSW_LIBRARY_TYPE SHARED)
else()
set(ZFSW_LIBRARY_TYPE STATIC)
endif()
find_package(Threads REQUIRED)
add_library(${PROJECT_NAME} ${ZFSW_LIBRARY_TYPE}
${ZFS_WRAPPER_SOURCES}
)
if(ZFSW_HAS_ZPOOL_STATUS_COMPATIBILITY_ERR)
add_compile_definitions(${PROJECT_NAME} ZFSW_HAS_ZPOOL_STATUS_COMPATIBILITY_ERR)
endif()
if(ZFSW_HAS_ZPOOL_STATUS_INCOMPATIBLE_FEAT)
add_compile_definitions(${PROJECT_NAME} ZFSW_HAS_ZPOOL_STATUS_INCOMPATIBLE_FEAT)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE
ZFSDependencies
Threads::Threads
)
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> # <prefix>/include/
)
target_compile_options(${PROJECT_NAME} PRIVATE
-Wall -Wextra -pedantic -Werror
-Wno-error=unknown-pragmas
-Wno-missing-field-initializers
)
# Organization in Xcode and Co
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${QN_SOURCES})