FindCyrusSASL.cmake 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Licensed to the Apache Software Foundation (ASF) under one
  2. # or more contributor license agreements. See the NOTICE file
  3. # distributed with this work for additional information
  4. # regarding copyright ownership. The ASF licenses this file
  5. # to you under the Apache License, Version 2.0 (the
  6. # "License"); you may not use this file except in compliance
  7. # with the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. # - Find Cyrus SASL (sasl.h, libsasl2.so)
  18. #
  19. # This module defines
  20. # CYRUS_SASL_INCLUDE_DIR, directory containing headers
  21. # CYRUS_SASL_SHARED_LIB, path to Cyrus SASL's shared library
  22. # CYRUS_SASL_FOUND, whether Cyrus SASL and its plugins have been found
  23. #
  24. # It also defines the following IMPORTED targets:
  25. # CyrusSASL
  26. #
  27. # Hints:
  28. # Set CYRUS_SASL_ROOT_DIR to the root directory of a Cyrus SASL installation.
  29. #
  30. # The initial version of this file was extracted from
  31. # https://github.com/cloudera/kudu, at the following commit:
  32. #
  33. # commit 9806863e78107505a622b44112a897189d9b3c24
  34. # Author: Dan Burkert <dan@cloudera.com>
  35. # Date: Mon Nov 30 12:15:36 2015 -0800
  36. #
  37. # Enable C++11
  38. find_path(CYRUS_SASL_INCLUDE_DIR sasl/sasl.h HINTS "${CYRUS_SASL_ROOT_DIR}/include")
  39. find_library(CYRUS_SASL_SHARED_LIB sasl2 HINTS "${CYRUS_SASL_ROOT_DIR}/lib")
  40. include(FindPackageHandleStandardArgs)
  41. find_package_handle_standard_args(CYRUS_SASL REQUIRED_VARS
  42. CYRUS_SASL_SHARED_LIB CYRUS_SASL_INCLUDE_DIR)
  43. if(CYRUS_SASL_FOUND)
  44. if(NOT TARGET CyrusSASL)
  45. add_library(CyrusSASL UNKNOWN IMPORTED)
  46. set_target_properties(CyrusSASL PROPERTIES
  47. INTERFACE_INCLUDE_DIRECTORIES "${CYRUS_SASL_INCLUDE_DIR}"
  48. IMPORTED_LINK_INTERFACE_LANGUAGES "C"
  49. IMPORTED_LOCATION "${CYRUS_SASL_SHARED_LIB}")
  50. endif()
  51. endif()