forked from lizardfs/lizardfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Libraries.cmake
106 lines (94 loc) · 3.62 KB
/
Libraries.cmake
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
# Download GoogleTest
if(ENABLE_TESTS)
set(GTEST_VERSION 1.7.0)
set(GTEST_NAME gtest-${GTEST_VERSION})
if(NOT IS_DIRECTORY ${CMAKE_SOURCE_DIR}/external/${GTEST_NAME})
set(GTEST_ARCHIVE ${GTEST_NAME}.zip)
set(GTEST_URL http://googletest.googlecode.com/files/${GTEST_ARCHIVE})
set(GTEST_ARCHIVE_MD5 2d6ec8ccdf5c46b05ba54a9fd1d130d7)
message(STATUS "Downloading ${GTEST_URL}...")
file(DOWNLOAD
${GTEST_URL}
${CMAKE_BINARY_DIR}/${GTEST_ARCHIVE}
INACTIVITY_TIMEOUT 15
SHOW_PROGRESS
STATUS DOWNLOAD_STATUS
EXPECTED_MD5 ${GTEST_ARCHIVE_MD5})
list(GET DOWNLOAD_STATUS 0 DOWNLOAD_CODE)
if(NOT DOWNLOAD_CODE EQUAL 0)
list(GET DOWNLOAD_STATUS 1 DOWNLOAD_MESSAGE)
message(FATAL_ERROR "Download ${GTEST_URL} error ${DOWNLOAD_CODE}: ${DOWNLOAD_MESSAGE}")
endif()
message(STATUS "Unpacking ${GTEST_ARCHIVE}...")
execute_process(COMMAND unzip -q ${CMAKE_BINARY_DIR}/${GTEST_ARCHIVE}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/external
RESULT_VARIABLE UNZIP_ERROR
ERROR_VARIABLE UNZIP_ERROR_MESSAGE)
if(NOT UNZIP_ERROR STREQUAL 0)
message(FATAL_ERROR "unzip ${GTEST_ARCHIVE} failed: ${UNZIP_ERROR} ${UNZIP_ERROR_MESSAGE}")
endif()
if(NOT IS_DIRECTORY ${CMAKE_SOURCE_DIR}/external/${GTEST_NAME})
message(FATAL_ERROR "Extracting ${GTEST_ARCHIVE} didn't produce directory '${GTEST_NAME}'")
endif()
message(STATUS "Downloading ${GTEST_NAME} finished successfully")
else()
message(STATUS "Found ${GTEST_NAME}")
endif()
endif()
# Find standard libraries
find_package(Socket)
find_package(Threads)
find_package(ZLIB REQUIRED)
find_library(FUSE_LIBRARY fuse)
message(STATUS "FUSE_LIBRARY: ${FUSE_LIBRARY}")
find_library(RT_LIBRARY rt)
message(STATUS "RT_LIBRARY: ${RT_LIBRARY}")
# Find extra binaries
find_program(A2X_BINARY a2x)
message(STATUS "a2x: ${A2X_BINARY}")
# Find Boost
set(BOOST_MIN_VERSION "1.48.0")
find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS regex thread program_options)
find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS filesystem system REQUIRED)
# Find Thrift
find_package(Thrift COMPONENTS library)
if(THRIFT_FOUND)
message(STATUS "Found Thrift")
else()
message(STATUS "Could NOT find Thrift")
message(STATUS " If it's installed in a non-standard path, set THRIFT_ROOT variable")
message(STATUS " to point this path (cmake -DTHRIFT_ROOT=...)")
endif()
# Find Polonaise
set(POLONAISE_REQUIRED_VERSION 0.3.0)
find_package(Polonaise ${POLONAISE_REQUIRED_VERSION} EXACT QUIET NO_MODULE NO_CMAKE_BUILDS_PATH)
if(POLONAISE_FOUND)
if(Boost_PROGRAM_OPTIONS_FOUND)
message(STATUS "Found Polonaise")
else()
message(STATUS "Missing Polonaise dependencies: boost-program_options")
set(POLONAISE_FOUND false)
endif()
else()
message(STATUS "Could NOT find Polonaise v${POLONAISE_REQUIRED_VERSION}")
if (Polonaise_CONSIDERED_VERSIONS)
message(STATUS " Incompatible versions ${Polonaise_CONSIDERED_VERSIONS} "
"found in ${Polonaise_CONSIDERED_CONFIGS}")
endif()
message(STATUS " If it's installed in a non-standard path, set Polonaise_DIR variable")
message(STATUS " to point this path (cmake -DPolonaise_DIR=...)")
endif()
# Find crcutil
set(CRCUTIL_VERSION crcutil-1.0)
set(CRCUTIL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/external/${CRCUTIL_VERSION}/code)
set(CRCUTIL_SOURCE_DIR ${CMAKE_SOURCE_DIR}/external/${CRCUTIL_VERSION}/code)
if(CXX_HAS_MCRC32)
set(CRCUTIL_CXX_FLAGS "-mcrc32")
else()
set(CRCUTIL_CXX_FLAGS "")
endif()
# Find GoogleTest
if(ENABLE_TESTS)
set(GTEST_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/external/${GTEST_NAME}/include)
set(TEST_LIBRARIES "" CACHE INTERNAL "" FORCE)
endif()