-
Notifications
You must be signed in to change notification settings - Fork 15
/
CMakeLists.txt
92 lines (70 loc) · 2.91 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
cmake_minimum_required( VERSION 2.6 )
project( xrootd-hdfs )
set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake )
find_package( Xrootd REQUIRED )
find_package( Hdfs REQUIRED )
find_package( Jvm REQUIRED )
find_package( Dl REQUIRED )
if(NOT XROOTD_PLUGIN_VERSION)
find_program(XROOTD_CONFIG_EXECUTABLE xrootd-config)
exec_program(${XROOTD_CONFIG_EXECUTABLE} ARGS "--plugin-version" OUTPUT_VARIABLE XROOTD_PLUGIN_VERSION RETURN_VALUE RETVAR)
set(XROOTD_PLUGIN_VERSION ${XROOTD_PLUGIN_VERSION} CACHE INTERNAL "")
endif()
include (FindPkgConfig)
pkg_check_modules(LIBCRYPTO REQUIRED libcrypto)
pkg_check_modules(ZLIB REQUIRED zlib)
macro(use_cxx11)
if (CMAKE_VERSION VERSION_LESS "3.1")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set (CMAKE_CXX_FLAGS "-std=gnu++11 ${CMAKE_CXX_FLAGS}")
endif ()
else ()
set (CMAKE_CXX_STANDARD 11)
endif ()
endmacro(use_cxx11)
use_cxx11()
if( CMAKE_COMPILER_IS_GNUCXX )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror" )
endif()
if( CMAKE_COMPILER_IS_GNUCC )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror" )
endif()
SET( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
SET( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined")
SET( CMAKE_EXE_LINKER_FLAGS "-Wl,--no-undefined")
include_directories(${HDFS_INCLUDES} ${JVM_INCLUDES} ${JVM_MD_INCLUDES} ${LIBCRYPTO_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS})
include_directories( "${PROJECT_SOURCE_DIR}" "${XROOTD_INCLUDES}" )
add_library(XrdHdfs MODULE src/XrdHdfsBootstrap.cc src/XrdHdfsChecksum.cc src/XrdHdfsChecksumCalc.cc)
target_link_libraries(XrdHdfs ${XROOTD_UTILS} ${XROOTD_SERVER} ${DL_LIB} ${LIBCRYPTO_LIBRARIES} ${ZLIB_LIBRARIES})
set_target_properties(XrdHdfs PROPERTIES OUTPUT_NAME "XrdHdfs-${XROOTD_PLUGIN_VERSION}" LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/src/export-lib-symbols")
add_library(XrdHdfsReal MODULE src/XrdHdfs.cc src/XrdHdfsConfig.cc src/XrdHdfs.hh src/XrdHdfsChecksum.cc src/XrdHdfsChecksumCalc.cc)
target_link_libraries(XrdHdfsReal ${HDFS_LIB} ${XROOTD_UTILS} ${XROOTD_SERVER} ${LIBCRYPTO_LIBRARIES} ${ZLIB_LIBRARIES})
set_target_properties(XrdHdfsReal PROPERTIES OUTPUT_NAME "XrdHdfsReal-${XROOTD_PLUGIN_VERSION}" LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/src/export-lib-symbols")
add_executable(xrootd_hdfs_envcheck src/XrdHdfsEnvCheck.cc)
if (NOT DEFINED LIB_INSTALL_DIR)
SET(LIB_INSTALL_DIR "lib")
endif()
install(
TARGETS XrdHdfs
LIBRARY DESTINATION ${LIB_INSTALL_DIR} )
install(
TARGETS XrdHdfsReal
LIBRARY DESTINATION ${LIB_INSTALL_DIR} )
install(
TARGETS xrootd_hdfs_envcheck
DESTINATION bin)
install(
FILES ${CMAKE_SOURCE_DIR}/src/XrdHdfs.hh
DESTINATION include )
install(
FILES
${CMAKE_SOURCE_DIR}/configs/config.d/40-xrootd-hdfs.cfg
DESTINATION ${SYSCONF_INSTALL_DIR}/xrootd/config.d
PERMISSIONS
OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
set_target_properties(
XrdHdfs
PROPERTIES
VERSION "0.0.1"
SOVERSION "0"
LINK_INTERFACE_LIBRARIES "" )