FindLibRec.cmake 1.18 KB
Newer Older
1 2
# This module finds librec.
#
3
# User can give LIBREC_INSTALL_DIR as a hint stored in the cmake cache.
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
#
# It sets the following variables:
#  LIBREC_FOUND              - Set to false, or undefined, if librec isn't found.
#  LIBREC_INCLUDE_DIRS       - include directory
#  LIBREC_LIBRARIES          - library files

set(LIBREC_INSTALL_DIR "" CACHE PATH "Librec install directory")

# Include dir
find_path(LIBREC_INCLUDE_DIR
  NAMES rec.h
  HINTS ${LIBREC_INSTALL_DIR}/include
  PATHS ENV C_INCLUDE_PATH
  ENV C_PLUS_INCLUDE_PATH
  ENV INCLUDE_PATH
)

# Finally the library itself
find_library(LIBREC_LIBRARY
  NAMES rec librec
  HINTS ${LIBREC_INSTALL_DIR}/lib
  PATHS ENV LIBRARY_PATH
  ENV LD_LIBRARY_PATH
)

message(STATUS "librec library: ${LIBREC_LIBRARY}")

include(FindPackageHandleStandardArgs)
32
# handle the QUIETLY and REQUIRED arguments and set LIBREC_FOUND to TRUE
33
# if all listed variables are TRUE
34
find_package_handle_standard_args(LibRec  DEFAULT_MSG
35 36 37 38 39 40 41 42 43
                                  LIBREC_LIBRARY LIBREC_INCLUDE_DIR)

mark_as_advanced(LIBREC_INCLUDE_DIR LIBREC_LIBRARY )
if(LIBREC_FOUND)
  set(LIBREC_LIBRARIES ${LIBREC_LIBRARY} )
  set(LIBREC_INCLUDE_DIRS ${LIBREC_INCLUDE_DIR} )
endif()