-
Notifications
You must be signed in to change notification settings - Fork 8
/
FindStereoPipeline.cmake
105 lines (88 loc) · 3.12 KB
/
FindStereoPipeline.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
# Find Stereo Pipeline
#
# Provide directory hint like this:
# set(StereoPipeline_ROOT "/some/path")
#
# == Using Header-Only libraries from within Stereo Pipeline: ==
#
# find_package( StereoPipeline 2.0 )
# if(StereoPipeline_FOUND)
# include_directories(${StereoPipeline_INCLUDE_DIRS})
# add_executable(foo foo.cc)
# endif()
#
# == Using actual libraries from within StereoPipeline: ==
#
# find_package( StereoPipeline 2.0 COMPONENTS core isisio ... )
#
# if(StereoPipeline_FOUND)
# include_directories(${StereoPipeline_INCLUDE_DIRS})
# add_executable(foo foo.cc)
# target_link_libraries(foo ${StereoPipeline_LIBRARIES})
# endif()
#
# ===========================================================
#
# Copyright (c) 2010 Zachary Moratto
#
# Redistribution AND use is allowed according to the terms
# of the NEW BSD license.
#
# This macro must define:
# StereoPipeline_FOUND < Conditional
# StereoPipeline_INCLUDE_DIR < Paths
# StereoPipeline_LIBRARIES < Paths as well
# Find Path
find_path(StereoPipeline_DIR
NAMES include/asp/Core.h
lib/libaspCore.dylib
HINTS ${StereoPipeline_ROOT}
)
#message("Found main dir ${StereoPipeline_DIR}")
find_path(StereoPipeline_INCLUDE_DIR
NAMES asp/Core.h
HINTS ${StereoPipeline_DIR}
PATH_SUFFIXES include
)
#message("Found include dir ${StereoPipeline_INCLUDE_DIR}")
# Searching for each library that makes up a component
foreach(COMPONENT ${StereoPipeline_FIND_COMPONENTS})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
set( StereoPipeline_${UPPERCOMPONENT}_LIBRARY "StereoPipeline_${UPPERCOMPONENT}_LIBRARY-NOTFOUND")
string(REGEX REPLACE "^(.)(.+)$" "\\1" first_half "${UPPERCOMPONENT}")
string(REGEX REPLACE "^(.)(.+)$" "\\2" second_half "${COMPONENT}")
set(LIBRARY_NAME "${first_half}${second_half}")
if ( ${UPPERCOMPONENT} STREQUAL "ISISIO" )
set(LIBRARY_NAME "IsisIO")
elseif( ${UPPERCOMPONENT} STREQUAL "PHOTOMETRYTK" )
set(LIBRARY_NAME "PhotometryTK")
endif()
find_library( StereoPipeline_${UPPERCOMPONENT}_LIBRARY
NAMES asp${LIBRARY_NAME}
HINTS ${StereoPipeline_DIR}
PATH_SUFFIXES lib lib64
)
if(StereoPipeline_${UPPERCOMPONENT}_LIBRARY)
set(StereoPipeline_${UPPERCOMPONENT}_FOUND TRUE CACHE INTERNAL "If the ASP ${UPPERCOMPONENT} library was found")
endif()
endforeach(COMPONENT)
# Deciding if ASP was found
set(StereoPipeline_INCLUDE_DIRS ${StereoPipeline_INCLUDE_DIR})
if(StereoPipeline_INCLUDE_DIR)
set(StereoPipeline_FOUND TRUE)
else(StereoPipeline_INCLUDE_DIR)
set(StereoPipeline_FOUND FALSE)
endif(StereoPipeline_INCLUDE_DIR)
# Closing Messages
if(StereoPipeline_FOUND)
message(STATUS "Found the following StereoPipeline libraries:")
foreach( COMPONENT ${StereoPipeline_FIND_COMPONENTS})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT )
if ( StereoPipeline_${UPPERCOMPONENT}_FOUND )
message(STATUS " ${COMPONENT}")
set(StereoPipeline_LIBRARIES ${StereoPipeline_LIBRARIES} ${StereoPipeline_${UPPERCOMPONENT}_LIBRARY})
endif()
endforeach()
else(StereoPipeline_FOUND)
message(WARNING "Unable to find requested StereoPipeline libraries")
endif(StereoPipeline_FOUND)