-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
130 lines (106 loc) · 3.47 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
cmake_minimum_required(VERSION 3.5.0 FATAL_ERROR) #CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(MUNGEFS_VERSION_MAJOR "1")
set(MUNGEFS_VERSION_MINOR "0")
set(MUNGEFS_VERSION_PATCH "7")
set(MUNGEFS_VERSION "${MUNGEFS_VERSION_MAJOR}.${MUNGEFS_VERSION_MINOR}.${MUNGEFS_VERSION_PATCH}")
set(MUNGEFS_CXX_STANDARD 14)
project(mungefs
VERSION "${MUNGEFS_VERSION}"
LANGUAGES C CXX)
set(MUNGEFS_PLATFORM_STRING linux_platform)
set(MUNGEFS_COMPILE_DEFINITIONS ${MUNGEFS_PLATFORM_STRING} _LARGEFILE_SOURCE _FILE_OFFSET_BITS=64 _LARGE_FILES _LARGEFILE64_SOURCE BOOST_SYSTEM_NO_DEPRECATED)
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build {Debug, Release}." FORCE)
message(STATUS "Setting unspecified CMAKE_BUILD_TYPE to '${CMAKE_BUILD_TYPE}'. This is the correct setting for normal builds.")
endif()
add_compile_options(-Wall)
set(MUNGEFS_BUILD_WITH_WERROR FALSE CACHE BOOL "Choose whether to compile with -Werror.")
if (MUNGEFS_BUILD_WITH_WERROR)
add_compile_options(-Werror)
endif()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(Boost REQUIRED
COMPONENTS system filesystem program_options)
find_package(LibArchive REQUIRED)
find_package(FUSE 2.6 REQUIRED)
find_package(AvroCpp REQUIRED)
find_package(cppzmq REQUIRED)
add_executable(
mungefs
"${CMAKE_CURRENT_SOURCE_DIR}/mungefs_server.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/mungefs_operations.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
)
target_link_libraries(
mungefs
PRIVATE
${FUSE_LIBRARIES}
cppzmq::cppzmq
Avro::AvroCpp
Boost::system
Boost::filesystem
LibArchive::LibArchive
Threads::Threads
)
target_include_directories(
mungefs
PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/include"
${FUSE_INCLUDE_DIRS}
)
target_compile_definitions(mungefs PRIVATE ${MUNGEFS_COMPILE_DEFINITIONS})
target_compile_options(mungefs PRIVATE -Wno-write-strings)
set_property(TARGET mungefs PROPERTY CXX_STANDARD ${MUNGEFS_CXX_STANDARD})
add_executable(
mungefsctl
${CMAKE_CURRENT_SOURCE_DIR}/mungefsctl.cpp
)
target_link_libraries(
mungefsctl
PRIVATE
${FUSE_LIBRARIES}
cppzmq::cppzmq
Avro::AvroCpp
Boost::system
Boost::filesystem
Boost::program_options
Threads::Threads
)
target_include_directories(
mungefsctl
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/include
)
target_compile_definitions(mungefsctl PRIVATE ${MUNGEFS_COMPILE_DEFINITIONS})
target_compile_options(mungefsctl PRIVATE -Wno-write-strings)
set_property(TARGET mungefsctl PROPERTY CXX_STANDARD ${MUNGEFS_CXX_STANDARD})
set (
AVRO_FILE
mungefs_ctl
)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include")
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/include/${AVRO_FILE}.hpp"
COMMAND "${AVROCPP_AVROGEN_EXECUTABLE}" -o "${CMAKE_CURRENT_BINARY_DIR}/include/${AVRO_FILE}.hpp" -i "${CMAKE_CURRENT_SOURCE_DIR}/avro_schemas/${AVRO_FILE}.json"
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/avro_schemas/${AVRO_FILE}.json"
)
set_source_files_properties(
"${CMAKE_CURRENT_SOURCE_DIR}/mungefsctl.cpp"
PROPERTIES
OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/include/${AVRO_FILE}.hpp"
)
set_source_files_properties(
"${CMAKE_CURRENT_SOURCE_DIR}/mungefs_server.cpp"
PROPERTIES
OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/include/${AVRO_FILE}.hpp"
)
include(GNUInstallDirs)
install(
TARGETS
mungefs
mungefsctl
RUNTIME
DESTINATION "${CMAKE_INSTALL_BINDIR}"
)