forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindCastor.cmake
67 lines (56 loc) · 1.99 KB
/
FindCastor.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
# - Try to find CASTOR
# (See http://savannah.cern.ch/files/?group=castor)
# Check for rfio_api.h, stager_api.h for CASTOR 2 and libshift
#
# CASTOR_INCLUDE_DIR - where to find rfio_api.h, etc.
# CASTOR_LIBRARIES - List of libraries when using ....
# CASTOR_FOUND - True if CASTOR 2 libraries found.
set(CASTOR_FOUND FALSE)
set(CASTOR_LIBRARIES)
if(CASTOR_INCLUDE_DIR)
set(CASTOR_FIND_QUIETLY 1)
endif()
find_path(CASTOR_INCLUDE_DIR NAMES rfio_api.h PATHS
${CASTOR_DIR}/include $ENV{CASTOR_DIR}/include
/cern/pro/include
/cern/new/include
/cern/old/include
/opt/shift/include
/usr/local/shift/include
/usr/include/shift
/usr/local/include/shift
PATH_SUFFIXES shift
)
if(CASTOR_INCLUDE_DIR)
file(READ ${CASTOR_INCLUDE_DIR}/patchlevel.h contents)
string(REGEX MATCH "BASEVERSION[ ]*[\"][ ]*([^ \"]+)" cont ${contents})
string(REGEX REPLACE "BASEVERSION[ ]*[\"][ ]*([^ \"]+)" "\\1" CASTOR_VERSION ${cont})
endif()
set(locations ${CASTOR_DIR} $ENV{CASTOR_DIR}
/cern/pro /cern/new /cern/old
/opt/shift /usr/local/shift
/usr/lib/shift /usr/local/lib/shift
)
find_library(CASTOR_shift_LIBRARY NAMES shift shiftmd HINTS ${locations})
find_library(CASTOR_rfio_LIBRARY NAMES castorrfio HINTS ${locations})
find_library(CASTOR_common_LIBRARY NAMES castorcommon HINTS ${locations})
find_library(CASTOR_client_LIBRARY NAMES castorclient castorClient HINTS ${locations})
find_library(CASTOR_ns_LIBRARY NAMES castorns HINTS ${locations})
if(CASTOR_shift_LIBRARY)
message(STATUS "Found Castor LIB AT ${CASTOR_shift_LIBRARY}")
set(CASTOR_LIBRARIES ${CASTOR_LIBRARIES} ${CASTOR_shift_LIBRARY})
endif()
if(CASTOR_INCLUDE_DIR AND CASTOR_LIBRARIES)
set(CASTOR_FOUND TRUE)
if(NOT CASTOR_FIND_QUIETLY)
message(STATUS "Found Castor version ${CASTOR_VERSION} at ${CASTOR_INCLUDE_DIR}")
endif()
endif()
mark_as_advanced(
CASTOR_shift_LIBRARY
CASTOR_rfio_LIBRARY
CASTOR_common_LIBRARY
CASTOR_client_LIBRARY
CASTOR_ns_LIBRARY
CASTOR_INCLUDE_DIR
)