FindPeary.cmake 1.65 KB
Newer Older
Simon Spannagel's avatar
Simon Spannagel committed
1
# - Try to find the Peary framework
2
# Once done this will define
Simon Spannagel's avatar
Simon Spannagel committed
3
4
5
#  Peary_FOUND - System has Peary
#  Peary_INCLUDE_DIRS - The Peary main include directory
#  Peary_LIBRARIES - The libraries for Peary and the required components
6

Simon Spannagel's avatar
Simon Spannagel committed
7
MESSAGE(STATUS "Looking for Peary...")
8

9
FIND_PATH(Peary_INCLUDE_DIR NAMES "peary/device/device.hpp" PATHS "$ENV{PEARYPATH}")
Simon Spannagel's avatar
Simon Spannagel committed
10
FIND_LIBRARY(Peary_LIBRARIES NAMES "peary" HINTS "$ENV{PEARYPATH}/lib")
11

12
13
14
LIST(APPEND Peary_INCLUDE_DIRS "${Peary_INCLUDE_DIR}/peary/utils")
LIST(APPEND Peary_INCLUDE_DIRS "${Peary_INCLUDE_DIR}/devices")

Simon Spannagel's avatar
Simon Spannagel committed
15
16
IF(Peary_FIND_COMPONENTS)
   FOREACH(component ${Peary_FIND_COMPONENTS})
17
18
      FIND_PATH(Peary_COMP_INCLUDE NAMES "devices/${component}/${component}Device.hpp" PATHS "$ENV{PEARYPATH}")
      FIND_LIBRARY(Peary_COMP_LIB NAMES "PearyDevice${component}" HINTS "$ENV{PEARYPATH}/lib")
Simon Spannagel's avatar
Simon Spannagel committed
19
20
      IF(Peary_COMP_INCLUDE AND Peary_COMP_LIB)
         LIST(APPEND Peary_LIBRARIES "${Peary_COMP_LIB}")
21
         LIST(APPEND Peary_INCLUDE_DIRS "${Peary_COMP_INCLUDE}/devices/${component}")
Simon Spannagel's avatar
Simon Spannagel committed
22
         SET(Peary_${component}_FOUND TRUE)
23
         MESSAGE(STATUS "Looking for Peary component: ${component} -- Found")
Simon Spannagel's avatar
Simon Spannagel committed
24
25
26
27
      ELSE()
         MESSAGE(STATUS "Looking for Peary component: ${component} -- NOTFOUND")
      ENDIF()
   ENDFOREACH()
28
29
ENDIF()

Simon Spannagel's avatar
Simon Spannagel committed
30
31
32
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Peary REQUIRED_VARS Peary_INCLUDE_DIRS Peary_LIBRARIES
                                        HANDLE_COMPONENTS
                                     FAIL_MESSAGE "Could not find Peary or a required component, make sure all necessary components are compiled and that the variable PEARYPATH points to the installation location:\n$ export PEARYPATH=/your/path/to/Peary\n")