-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindPylon.cmake
30 lines (26 loc) · 1.35 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
set(PYLON_ROOT $ENV{PYLON_ROOT})
if (NOT DEFINED ENV{PYLON_ROOT})
set(PYLON_ROOT "/opt/pylon")
endif()
set(_PYLON_CONFIG "${PYLON_ROOT}/bin/pylon-config")
if (EXISTS "${_PYLON_CONFIG}")
set(Pylon_FOUND TRUE)
execute_process(COMMAND ${_PYLON_CONFIG} --cflags-only-I OUTPUT_VARIABLE HEADERS_OUT)
execute_process(COMMAND ${_PYLON_CONFIG} --libs-only-l OUTPUT_VARIABLE LIBS_OUT)
execute_process(COMMAND ${_PYLON_CONFIG} --libs-only-L OUTPUT_VARIABLE LIBDIRS_OUT)
string(REPLACE " " ";" HEADERS_OUT "${HEADERS_OUT}")
string(REPLACE "-I" "" HEADERS_OUT "${HEADERS_OUT}")
string(REPLACE "\n" "" Pylon_INCLUDE_DIRS "${HEADERS_OUT}")
string(REPLACE " " ";" LIBS_OUT "${LIBS_OUT}")
string(REPLACE "-l" "" LIBS_OUT "${LIBS_OUT}")
string(REPLACE "\n" "" Pylon_LIBRARIES "${LIBS_OUT}")
string(REPLACE " " ";" LIBDIRS_OUT "${LIBDIRS_OUT}")
string(REPLACE "-L" "" LIBDIRS_OUT "${LIBDIRS_OUT}")
string(REPLACE "\n" "" LIBDIRS_OUT "${LIBDIRS_OUT}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
foreach (LIBDIR ${LIBDIRS_OUT})
link_directories(${LIBDIR})
endforeach()
else()
set(Pylon_FOUND FALSE)
endif()