FindQRencode.cmake raw

   1  # Copyright (c) 2024-present The Bitcoin Core developers
   2  # Distributed under the MIT software license, see the accompanying
   3  # file COPYING or https://opensource.org/license/mit/.
   4  
   5  #[=======================================================================[
   6  FindQRencode
   7  ------------
   8  
   9  Finds the QRencode header and library.
  10  
  11  This is a wrapper around find_package()/pkg_check_modules() commands that:
  12   - facilitates searching in various build environments
  13   - prints a standard log message
  14  
  15  #]=======================================================================]
  16  
  17  find_path(QRencode_INCLUDE_DIR
  18    NAMES qrencode.h
  19  )
  20  find_library(QRencode_LIBRARY_RELEASE
  21    NAMES qrencode
  22  )
  23  find_library(QRencode_LIBRARY_DEBUG
  24    NAMES qrencoded qrencode
  25  )
  26  
  27  include(FindPackageHandleStandardArgs)
  28  find_package_handle_standard_args(QRencode
  29    REQUIRED_VARS QRencode_LIBRARY_RELEASE QRencode_INCLUDE_DIR
  30  )
  31  
  32  if(QRencode_FOUND AND NOT TARGET QRencode::QRencode)
  33    add_library(QRencode::QRencode UNKNOWN IMPORTED)
  34    set_target_properties(QRencode::QRencode PROPERTIES
  35      IMPORTED_CONFIGURATIONS RELEASE
  36      IMPORTED_LOCATION_RELEASE "${QRencode_LIBRARY_RELEASE}"
  37      INTERFACE_INCLUDE_DIRECTORIES "${QRencode_INCLUDE_DIR}"
  38    )
  39    if(QRencode_LIBRARY_DEBUG)
  40      set_property(TARGET QRencode::QRencode APPEND PROPERTY
  41        IMPORTED_CONFIGURATIONS DEBUG
  42      )
  43      set_target_properties(QRencode::QRencode PROPERTIES
  44        IMPORTED_LOCATION_DEBUG "${QRencode_LIBRARY_DEBUG}"
  45      )
  46    endif()
  47  endif()
  48  
  49  mark_as_advanced(
  50    QRencode_INCLUDE_DIR
  51    QRencode_LIBRARY_RELEASE
  52    QRencode_LIBRARY_DEBUG
  53  )
  54