FindChipmunk.cmake 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #.rst:
  2. # FindChipmunk
  3. # ------------
  4. #
  5. # Locate Chipmunk library
  6. #
  7. # This module defines
  8. #
  9. # ::
  10. #
  11. # CHIPMUNK_LIBRARIES, the library to link against
  12. # CHIPMUNK_FOUND, if false, do not try to link to Chipmunk
  13. # CHIPMUNK_INCLUDE_DIRS, where to find headers.
  14. # This is the concatenation of the paths:
  15. # CHIPMUNK_INCLUDE_DIR
  16. #
  17. #=============================================================================
  18. # Copyright 2014-2014 Martell Malone
  19. #
  20. # Distributed under the OSI-approved BSD License (the "License");
  21. # see accompanying file Copyright.txt for details.
  22. #
  23. # This software is distributed WITHOUT ANY WARRANTY; without even the
  24. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  25. # See the License for more information.
  26. #=============================================================================
  27. # (To distribute this file outside of CMake, substitute the full
  28. # License text for the above reference.)
  29. FIND_PATH(CHIPMUNK_INCLUDE_DIR chipmunk/chipmunk.h
  30. HINTS
  31. ENV CHIPMUNK_DIR
  32. PATH_SUFFIXES include
  33. PATHS
  34. ~/Library/Frameworks
  35. /Library/Frameworks
  36. /usr/local
  37. /usr
  38. /sw # Fink
  39. /opt/local # DarwinPorts
  40. /opt/csw # Blastwave
  41. /opt
  42. )
  43. FIND_LIBRARY(CHIPMUNK_LIBRARY
  44. NAMES chipmunk libchipmunk
  45. HINTS
  46. ENV CHIPMUNK_DIR
  47. PATH_SUFFIXES lib
  48. PATHS
  49. ~/Library/Frameworks
  50. /Library/Frameworks
  51. /usr/local
  52. /usr
  53. /sw
  54. /opt/local
  55. /opt/csw
  56. /opt
  57. )
  58. set(CHIPMUNK_INCLUDE_DIRS "${CHIPMUNK_INCLUDE_DIR}")
  59. IF(CHIPMUNK_LIBRARY)
  60. # include the math library for Unix
  61. IF(UNIX AND NOT APPLE)
  62. FIND_LIBRARY(CHIPMUNK_MATH_LIBRARY m)
  63. SET(CHIPMUNK_LIBRARIES "${CHIPMUNK_LIBRARY};${CHIPMUNK_MATH_LIBRARY}" CACHE STRING "Chipmunk Libraries")
  64. # For Windows and Mac, don't need to explicitly include the math library
  65. ELSE(UNIX AND NOT APPLE)
  66. SET( CHIPMUNK_LIBRARIES "${CHIPMUNK_LIBRARY}" CACHE STRING "Chipmunk Libraries")
  67. ENDIF(UNIX AND NOT APPLE)
  68. ENDIF(CHIPMUNK_LIBRARY)
  69. INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  70. # handle the QUIETLY and REQUIRED arguments and set CHIPMUNK_FOUND to TRUE if
  71. # all listed variables are TRUE
  72. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Chipmunk DEFAULT_MSG CHIPMUNK_LIBRARIES CHIPMUNK_INCLUDE_DIR)
  73. MARK_AS_ADVANCED(CHIPMUNK_INCLUDE_DIR CHIPMUNK_LIBRARIES CHIPMUNK_LIBRARY CHIPMUNK_MATH_LIBRARY)