aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/FindSmctemp.cmake
blob: 3cfa5d6fa5672661e74f0fc371355014e79ab40c (plain)
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
#.rst:
# FindSmctemp
# -------
# Finds the smctemp library
#
# This will define the following imported targets::
#
#   ${APP_NAME_LC}::Smctemp   - The smctemp library

if(NOT TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME})

  find_path(SMCTEMP_INCLUDE_DIR NAMES smctemp.h
                                HINTS ${DEPENDS_PATH}/include)
  find_library(SMCTEMP_LIBRARY NAMES smctemp
                               HINTS ${DEPENDS_PATH}/lib)

  include(FindPackageHandleStandardArgs)
  find_package_handle_standard_args(Smctemp
                                    REQUIRED_VARS SMCTEMP_LIBRARY SMCTEMP_INCLUDE_DIR
                                    VERSION_VAR SMCTEMP_VERSION)

  if(SMCTEMP_FOUND)
    add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} UNKNOWN IMPORTED)
    set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
                                                                     IMPORTED_LOCATION "${SMCTEMP_LIBRARY}"
                                                                     INTERFACE_INCLUDE_DIRECTORIES "${SMCTEMP_INCLUDE_DIR}")
  else()
    if(Smctemp_FIND_REQUIRED)
      message(FATAL_ERROR "Smctemp library not found.")
    endif()
  endif()
endif()