forked from erikmuttersbach/libhdfs3
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
64 lines (49 loc) · 2.5 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
SET(CMAKE_VERBOSE_MAKEFILE ON CACHE STRING "Verbose build." FORCE)
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
MESSAGE(FATAL_ERROR "cannot build the project in the source directory! Out-of-source build is enforced!")
ENDIF()
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
SET(DOXYFILE_PATH ${CMAKE_SOURCE_DIR}/docs)
if (NOT DEFINED URL_BASE)
set(URL_BASE "github.com")
endif()
# vcpkg init
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
find_package(Git REQUIRED)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file")
endif()
PROJECT(libhdfs3 VERSION "3.0.0")
find_package(libxml2 REQUIRED)
find_package(protobuf REQUIRED)
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
find_package(unofficial-libuuid REQUIRED)
set(LIBUUID_LIBRARIES unofficial::UUID::uuid)
endif()
INCLUDE(Platform)
INCLUDE(Functions)
INCLUDE(Options)
IF (WITH_KERBEROS)
FIND_PACKAGE(KERBEROS REQUIRED)
ENDIF()
FIND_PACKAGE(GSasl REQUIRED)
ADD_SUBDIRECTORY(mock)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(gtest)
ADD_SUBDIRECTORY(gmock)
ADD_SUBDIRECTORY(test)
ADD_SUBDIRECTORY(hdfs_benchmark)
ADD_CUSTOM_TARGET(doc
COMMAND doxygen ${CMAKE_BINARY_DIR}/src/doxyfile
WORKING_DIRECTORY ${DOXYFILE_PATH}
COMMENT "Generate documents..."
)
ADD_CUSTOM_TARGET(style
COMMAND astyle --style=attach --indent=spaces=4 --indent-preprocessor --break-blocks --pad-oper --pad-header --unpad-paren --delete-empty-lines --suffix=none --align-pointer=middle --lineend=linux --indent-col1-comments ${libhdfs3_SOURCES}
COMMAND astyle --style=attach --indent=spaces=4 --indent-preprocessor --break-blocks --pad-oper --pad-header --unpad-paren --delete-empty-lines --suffix=none --align-pointer=middle --lineend=linux --indent-col1-comments ${unit_SOURCES}
COMMAND astyle --style=attach --indent=spaces=4 --indent-preprocessor --break-blocks --pad-oper --pad-header --unpad-paren --delete-empty-lines --suffix=none --align-pointer=middle --lineend=linux --indent-col1-comments ${function_SOURCES}
COMMAND astyle --style=attach --indent=spaces=4 --indent-preprocessor --break-blocks --pad-oper --pad-header --unpad-paren --delete-empty-lines --suffix=none --align-pointer=middle --lineend=linux --indent-col1-comments ${secure_SOURCES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "format code style..."
)