-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
98 lines (77 loc) · 3.46 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
## cmake build script for srm-ifce
project (gfal2)
cmake_minimum_required (VERSION 2.6)
message ("cmake source dir : ${CMAKE_SOURCE_DIR}")
# default set of options
set (MAIN_CORE TRUE CACHE STRING "enable compilation of the main library")
set (MAIN_TRANSFER TRUE CACHE STRING "enable compilation of the transfer library")
set (PLUGIN_SFTP TRUE CACHE STRING "enable compilation of the sftp plugin")
set (PLUGIN_SRM TRUE CACHE STRING "enable compilation of the srm plugin")
set (PLUGIN_DCAP TRUE CACHE STRING "enable compilation of the DCAP plugin")
set (PLUGIN_FILE TRUE CACHE STRING "enable compilation of the local File plugin")
set (PLUGIN_GRIDFTP TRUE CACHE STRING "enable compilation of the GRIDFTP plugin")
set (PLUGIN_HTTP TRUE CACHE STRING "enable compilation of the HTTP plugin")
set (PLUGIN_XROOTD TRUE CACHE STRING "enable compilation of the XROOTD plugin")
set (PLUGIN_MOCK FALSE CACHE STRING "enable compilation of the MOCK plugin")
# Deprecated / unsupported protocols after CC7
set (PLUGIN_LFC FALSE CACHE STRING "enable compilation of the lfc plugin")
set (PLUGIN_RFIO FALSE CACHE STRING "enable compilation of the RFIO plugin")
# build type
set (CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "type of build")
set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
# load modules
include(DefineInstallationPaths REQUIRED)
include(MacroCopyFile REQUIRED)
include(ReleaseDebugAutoFlags REQUIRED)
include(CMakeGeneratePkgConfig REQUIRED)
include(MacroAddDoxygen REQUIRED)
include(CMakeCXX11Support REQUIRED)
# Enable C++11 support
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAG_ENABLE}")
# enable testing
include (CTest)
#define PROJECT vars
set (PROJECT_NAME_MAIN "gfal2")
set (OUTPUT_NAME_MAIN "gfal2")
set (PROJECT_NAME_TRANSFER "gfal_transfer")
set (OUTPUT_NAME_TRANSFER "gfal_transfer")
set (VERSION_MAJOR 2)
set (VERSION_MINOR 23)
set (VERSION_PATCH 0)
set (VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
add_definitions(-DVERSION="${VERSION_STRING}")
# out of project test compilation
set (ONLY_TESTS FALSE CACHE STRING "build only the tests")
set (SKIP_TESTS FALSE CACHE STRING "skip the tests")
# libs checks
find_package (GLIB2 REQUIRED)
find_package (GTHREAD2 REQUIRED)
find_package (JSONC REQUIRED)
# include directories
include_directories (${GLIB2_INCLUDE_DIRS})
include_directories (${GTHREAD2_INCLUDE_DIRS})
include_directories (${CMAKE_SOURCE_DIR}/src/core)
include_directories (${CMAKE_SOURCE_DIR}/src/utils)
# Core and plugins
if (NOT ONLY_TESTS)
# general parameters for configuration
add_definitions ( -DGFAL_PLUGIN_DIR_DEFAULT="${PLUGIN_INSTALL_DIR}" )
add_definitions ( -DGFAL_CONFIG_DIR_DEFAULT="${SYSCONF_INSTALL_DIR}" )
# add file offset 64 for 32 bits
add_definitions ( -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE)
#install doc license
install (FILES "LICENSE" "README.md" "RELEASE-NOTES" "DESCRIPTION" "readme.html"
DESTINATION ${DOC_INSTALL_DIR})
# install global configuration files
list (APPEND lst_conf_files
"${CMAKE_SOURCE_DIR}/dist/etc/gfal2.d/gfal2_core.conf"
"${CMAKE_SOURCE_DIR}/dist/etc/gfal2.d/bdii.conf"
"${CMAKE_SOURCE_DIR}/dist/etc/gfal2.d/x509.conf")
install (FILES ${lst_conf_files}
DESTINATION ${SYSCONF_INSTALL_DIR}/gfal2.d/)
add_subdirectory (doc)
add_subdirectory (src)
endif (NOT ONLY_TESTS)
if (NOT SKIP_TESTS)
add_subdirectory (test)
endif (NOT SKIP_TESTS)