🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
3.3 KiB

  1. # - Find MySOFA
  2. # Find the MySOFA libraries
  3. #
  4. # This module defines the following variables:
  5. # MYSOFA_FOUND - True if MYSOFA_INCLUDE_DIR & MYSOFA_LIBRARY are found
  6. # MYSOFA_INCLUDE_DIRS - where to find mysofa.h, etc.
  7. # MYSOFA_LIBRARIES - the MySOFA library
  8. #
  9. #=============================================================================
  10. # Copyright 2009-2011 Kitware, Inc.
  11. # Copyright 2009-2011 Philip Lowman <philip@yhbt.com>
  12. #
  13. # Redistribution and use in source and binary forms, with or without
  14. # modification, are permitted provided that the following conditions are
  15. # met:
  16. #
  17. # * Redistributions of source code must retain the above copyright notice,
  18. # this list of conditions and the following disclaimer.
  19. #
  20. # * Redistributions in binary form must reproduce the above copyright notice,
  21. # this list of conditions and the following disclaimer in the documentation
  22. # and/or other materials provided with the distribution.
  23. #
  24. # * The names of Kitware, Inc., the Insight Consortium, or the names of
  25. # any consortium members, or of any contributors, may not be used to
  26. # endorse or promote products derived from this software without
  27. # specific prior written permission.
  28. #
  29. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
  30. # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  31. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  32. # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
  33. # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  34. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  35. # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  36. # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  37. # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  38. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. #=============================================================================
  40. find_package(ZLIB)
  41. find_path(MYSOFA_INCLUDE_DIR NAMES mysofa.h
  42. DOC "The MySOFA include directory"
  43. )
  44. find_library(MYSOFA_LIBRARY NAMES mysofa
  45. DOC "The MySOFA library"
  46. )
  47. find_library(MYSOFA_M_LIBRARY NAMES m
  48. DOC "The math library for MySOFA"
  49. )
  50. # handle the QUIETLY and REQUIRED arguments and set MYSOFA_FOUND to TRUE if
  51. # all listed variables are TRUE
  52. include(FindPackageHandleStandardArgs)
  53. find_package_handle_standard_args(MYSOFA REQUIRED_VARS MYSOFA_LIBRARY MYSOFA_INCLUDE_DIR ZLIB_FOUND)
  54. if(MYSOFA_FOUND)
  55. set(MYSOFA_INCLUDE_DIRS ${MYSOFA_INCLUDE_DIR})
  56. set(MYSOFA_LIBRARIES ${MYSOFA_LIBRARY})
  57. set(MYSOFA_LIBRARIES ${MYSOFA_LIBRARIES} ZLIB::ZLIB)
  58. if(MYSOFA_M_LIBRARY)
  59. set(MYSOFA_LIBRARIES ${MYSOFA_LIBRARIES} ${MYSOFA_M_LIBRARY})
  60. endif()
  61. add_library(MySOFA::MySOFA UNKNOWN IMPORTED)
  62. set_property(TARGET MySOFA::MySOFA PROPERTY
  63. IMPORTED_LOCATION ${MYSOFA_LIBRARY})
  64. set_target_properties(MySOFA::MySOFA PROPERTIES
  65. INTERFACE_INCLUDE_DIRECTORIES ${MYSOFA_INCLUDE_DIRS}
  66. INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
  67. if(MYSOFA_M_LIBRARY)
  68. set_property(TARGET MySOFA::MySOFA APPEND PROPERTY
  69. INTERFACE_LINK_LIBRARIES ${MYSOFA_M_LIBRARY})
  70. endif()
  71. endif()
  72. mark_as_advanced(MYSOFA_INCLUDE_DIR MYSOFA_LIBRARY)