-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
103 lines (84 loc) · 3.32 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
#
# CMake build script to configure and build CernVM-FS' x509 authz helper.
#
cmake_minimum_required (VERSION 2.6.2)
set (PROJECT_NAME "CVMFS-X509-Helper")
project (${PROJECT_NAME})
message ("Running CMake version ${CMAKE_VERSION}")
#
# set the path where cmake looks for additional modules
#
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
#
# detect the operating system and the distribution we are compiling on
#
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set (MACOSX TRUE)
else (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set (MACOSX FALSE)
endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set (LINUX TRUE)
if (EXISTS /etc/debian_version)
set (DEBIAN TRUE)
endif (EXISTS /etc/debian_version)
if (EXISTS /etc/arch-release)
set (ARCHLINUX TRUE)
endif (EXISTS /etc/arch-release)
else (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set (LINUX FALSE)
set (DEBIAN FALSE)
set (ARCHLINUX FALSE)
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
#
# Set install prefix to /usr by default.
#
if (LINUX AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "CVMFS install path default is /usr" FORCE)
message("Setting default install prefix to ${CMAKE_INSTALL_PREFIX} on Linux")
endif (LINUX AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
#
# set default flags
#
# flags in CMAKE_C**_FLAGS are always passed to the compiler
#
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fno-strict-aliasing -fasynchronous-unwind-tables -fno-omit-frame-pointer -fvisibility=hidden -Wall -D_REENTRANT -D__EXTENSIONS__ -D_LARGEFILE64_SOURCE -D__LARGE64_FILES")
set (INCLUDE_DIRECTORIES ${INCLUDE_DIRECTORIES} src)
#
# check existence of include files
#
include (CheckIncludeFile)
include (GNUInstallDirs)
macro (pedantic_include_check HEADERFILE VARIABLENAME)
check_include_file (${HEADERFILE} ${VARIABLENAME})
if (NOT ${VARIABLENAME})
message (FATAL_ERROR "${HEADERFILE} is missing on your system")
endif (NOT ${VARIABLENAME})
endmacro (pedantic_include_check)
macro (look_for_include_files)
foreach (HEADER ${ARGV})
string (REGEX REPLACE "/|\\." "_" HEADER_VAR_LOWER ${HEADER})
string (TOUPPER "have_${HEADER_VAR_LOWER}" HEADER_VAR)
pedantic_include_check (${HEADER} ${HEADER_VAR})
endforeach (HEADER IN ITEMS ${ARGV})
endmacro (look_for_include_files)
set (REQUIRED_HEADERS alloca.h dlfcn.h errno.h fcntl.h inttypes.h limits.h
pthread.h stdint.h sys/types.h syslog.h time.h unistd.h
scitokens/scitokens.h)
look_for_include_files (${REQUIRED_HEADERS})
set (INCLUDE_DIRECTORIES ${INCLUDE_DIRECTORIES} ${CMAKE_BINARY_DIR})
find_library(SCITOKENS_LIB SciTokens)
# OpenSSL
find_package (OpenSSL REQUIRED)
set (INCLUDE_DIRECTORIES ${INCLUDE_DIRECTORIES} ${OPENSSL_INCLUDE_DIR})
# VOMS / globus libraries for secure CVMFS
find_package (VOMS REQUIRED)
set (INCLUDE_DIRECTORIES ${INCLUDE_DIRECTORIES} ${VOMS_INCLUDE_DIR})
add_definitions(-DVOMS_AUTHZ)
include (FindPkgConfig)
pkg_check_modules(GLOBUS REQUIRED globus-gsi-credential globus-gsi-cert-utils globus-common globus-gsi-sysconfig globus-gsi-callback)
set (INCLUDE_DIRECTORIES ${INCLUDE_DIRECTORIES} ${GLOBUS_INCLUDE_DIRS})
add_definitions(-DGLOBUS_AUTHZ)
include_directories (${INCLUDE_DIRECTORIES} vjson)
add_subdirectory (vjson)
add_subdirectory (src)