FindChipmunk.cmake 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # Locate Chipmunk physics library
  2. # This module defines
  3. # CHIPMUNK_FOUND, if false, do not try to link to Lua
  4. # CHIPMUNK_LIBRARIES
  5. # CHIPMNK_INCLUDE_DIR, where to find chipmunk.h
  6. #
  7. # Note that the expected include convention is
  8. # #include <chipmunk.h>
  9. # and not
  10. # #include <chipmunk/chipmunk.h>
  11. # This is because, the chipmunk location is not standardized and may exist
  12. # in locations other than chipmunk/
  13. #=============================================================================
  14. # Copyright 2012, Beoran beoran@rubyforge.org.
  15. #
  16. # License: you just do whatever you want with this file.
  17. #
  18. # This software is distributed WITHOUT ANY WARRANTY; without even the
  19. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  20. #
  21. #=============================================================================
  22. FIND_PATH(CHIPMUNK_INCLUDE_DIR chipmunk.h
  23. HINTS
  24. $ENV{CHIPMUNK_DIR}
  25. PATH_SUFFIXES include/chipmunk include
  26. PATHS
  27. ~/Library/Frameworks
  28. /Library/Frameworks
  29. /usr/local
  30. /usr
  31. /sw # Fink
  32. /opt/local # DarwinPorts
  33. /opt/csw # Blastwave
  34. /opt
  35. )
  36. FIND_LIBRARY(CHIPMUNK_LIBRARY
  37. NAMES chipmunk
  38. HINTS
  39. $ENV{CHIPMUNK_DIR}
  40. PATH_SUFFIXES lib64 lib
  41. PATHS
  42. ~/Library/Frameworks
  43. /Library/Frameworks
  44. /usr/local
  45. /usr
  46. /sw
  47. /opt/local
  48. /opt/csw
  49. /opt
  50. )
  51. IF(CHIPMUNK_LIBRARY)
  52. # include the math library for Unix
  53. IF(UNIX AND NOT APPLE)
  54. FIND_LIBRARY(CHIPMUNK_MATH_LIBRARY m)
  55. SET(CHIPMUNK_LIBRARIES "${CHIPMUNK_LIBRARY};${CHIPMUNK_MATH_LIBRARY}" CACHE STRING "Chipmunk Libraries")
  56. # For Windows and Mac, don't need to explicitly include the math library
  57. ELSE(UNIX AND NOT APPLE)
  58. SET( CHIPMUNK_LIBRARIES "${CHIPMUNK_LIBRARY}" CACHE STRING "Chipmunk Libraries")
  59. ENDIF(UNIX AND NOT APPLE)
  60. ENDIF(CHIPMUNK_LIBRARY)
  61. INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  62. # handle the QUIETLY and REQUIRED arguments and set CHIPMUNK_FOUND to TRUE if
  63. # all listed variables are TRUE
  64. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Chipmunk DEFAULT_MSG CHIPMUNK_LIBRARIES CHIPMUNK_INCLUDE_DIR)
  65. MARK_AS_ADVANCED(CHIPMUNK_INCLUDE_DIR CHIPMUNK_LIBRARIES CHIPMUNK_LIBRARY CHIPMUNK_MATH_LIBRARY)