-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFindpylon.cmake
116 lines (102 loc) · 3.4 KB
/
Findpylon.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
105
106
107
108
109
110
111
112
113
114
115
116
# Ad-hoc writings by Arseniy Terekhin<[email protected]>.
# Suggestions are welcomed!
set(PYLON_DIR "" CACHE STRING "pylon directory hint")
find_path(PYLON_INCLUDE_DIR GenICam.h
HINTS
${PYLON_DIR}
$ENV{PYLON_DIR}
$ENV{HOME}/.local
PATH_SUFFIXES include
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/usr/include/PYLON
/sw/include
/opt/local/include
/opt/pylon/include
/opt/include
/mingw/include
"C:/Program Files/Basler/pylon 6/Development/include"
"C:/Program Files/Basler/pylon 5/Development/include"
"D:/Program Files/Basler/pylon 6/Development/include"
"D:/Program Files/Basler/pylon 5/Development/include"
)
if (PYLON_INCLUDE_DIR AND EXISTS "${PYLON_INCLUDE_DIR}/pylon/PylonVersionNumber.h")
file(STRINGS "${PYLON_INCLUDE_DIR}/pylon/PylonVersionNumber.h" _VERSION_DEFS REGEX "^[ \t]*#define[ \t]+PYLON_VERSION_(MAJOR|MINOR|SUBMINOR)")
string(REGEX REPLACE ".*_MAJOR[ \t]+([0-9]+).*" "\\1" PYLON_VERSION_MAJ "${_VERSION_DEFS}")
string(REGEX REPLACE ".*_MINOR[ \t]+([0-9]+).*" "\\1" PYLON_VERSION_MIN "${_VERSION_DEFS}")
string(REGEX REPLACE ".*SUBMINOR[ \t]+([0-9]+).*" "\\1" PYLON_VERSION_MIC "${_VERSION_DEFS}")
set(PYLON_VERSION_STRING "${PYLON_VERSION_MAJ}.${PYLON_VERSION_MIN}.${PYLON_VERSION_MIC}")
unset(PYLON_VERSION_MAJ)
unset(PYLON_VERSION_MIN)
unset(PYLON_VERSION_MIC)
endif()
include(FindPackageHandleStandardArgs)
macro(PYLON_find_library varname)
find_library(${varname}
NAMES ${ARGN}
HINTS
${PYLON_DIR}
$ENV{PYLON_DIR}
$ENV{HOME}/.local
PATH_SUFFIXES lib64 lib bin
PATHS
/usr/local
/usr
/sw
/opt/local
/opt/pylon
/opt
/mingw
"${PYLON_INCLUDE_DIR}/../lib/x64"
)
endmacro()
PYLON_find_library(PYLON_BASE_LIBRARY
libpylonbase.so
PylonBase_MD_VC120_v5_0.lib
)
PYLON_find_library(PYLON_GC_BASE_LIBRARY
GCBase_MD_VC120_v3_0_Basler_pylon_v5_0.lib
libGCBase_gcc_v3_1_Basler_pylon.so
)
PYLON_find_library(PYLON_GENAPI_LIBRARY
GenApi_MD_VC120_v3_0_Basler_pylon_v5_0.lib
libGenApi_gcc_v3_1_Basler_pylon.so
)
PYLON_find_library(PYLON_UTILITY_LIBRARY
PylonUtility_MD_VC120_v5_0.lib
libpylonutility.so
)
find_package_handle_standard_args(
pylon
REQUIRED_VARS
PYLON_INCLUDE_DIR
PYLON_BASE_LIBRARY
PYLON_GC_BASE_LIBRARY
PYLON_GENAPI_LIBRARY
PYLON_UTILITY_LIBRARY
VERSION_VAR PYLON_VERSION_STRING
)
if(pylon_FOUND AND NOT TARGET pylon::pylon_base)
get_filename_component(pylon_LINK_DIRECTORIES "${PYLON_BASE_LIBRARY}" DIRECTORY)
add_library(pylon::pylon_base UNKNOWN IMPORTED)
set_target_properties(pylon::pylon_base PROPERTIES
IMPORTED_LOCATION "${PYLON_BASE_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${PYLON_INCLUDE_DIR}")
add_library(pylon::gc UNKNOWN IMPORTED)
set_target_properties(pylon::gc PROPERTIES
IMPORTED_LOCATION "${PYLON_GC_BASE_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${PYLON_INCLUDE_DIR}")
add_library(pylon::genapi UNKNOWN IMPORTED)
set_target_properties(pylon::genapi PROPERTIES
IMPORTED_LOCATION "${PYLON_GENAPI_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${PYLON_INCLUDE_DIR}")
add_library(pylon::utility UNKNOWN IMPORTED)
set_target_properties(pylon::utility PROPERTIES
IMPORTED_LOCATION "${PYLON_UTILITY_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${PYLON_INCLUDE_DIR}")
add_library(pylon INTERFACE)
target_link_libraries(pylon INTERFACE pylon::genapi pylon::gc pylon::utility pylon::pylon_base)
endif()