FindMruby.cmake 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # Locate Lua library
  2. # This module defines
  3. # MRUBY_FOUND, if false, do not try to link to mruby
  4. # MRUBY_LIBRARIES
  5. # MRUBY_INCLUDE_DIR, where to find mruby.h
  6. #
  7. # Copyright (c) beoran@rubyforge.org 2012
  8. #
  9. # Permission is hereby granted, free of charge, to any person obtaining
  10. # a copy of this software and associated documentation files (the
  11. # "Software"), to deal in the Software without restriction, including
  12. # without limitation the rights to use, copy, modify, merge, publish,
  13. # distribute, sublicense, and/or sell copies of the Software, and to
  14. # permit persons to whom the Software is furnished to do so, subject to
  15. # the following conditions:
  16. #
  17. # The above copyright notice and this permission notice shall be
  18. # included in all copies or substantial portions of the Software.
  19. #
  20. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  21. # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  23. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  24. # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  25. # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  26. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27. #
  28. FIND_PATH(MRUBY_INCLUDE_DIR mruby.h
  29. HINTS
  30. $ENV{MRUBY_DIR}
  31. PATH_SUFFIXES include/mruby include
  32. PATHS
  33. ~/Library/Frameworks
  34. /Library/Frameworks
  35. /usr/local
  36. /usr
  37. /sw # Fink
  38. /opt/local # DarwinPorts
  39. /opt/csw # Blastwave
  40. /opt
  41. )
  42. FIND_LIBRARY(MRUBY_LIBRARY
  43. NAMES libmruby.a mruby.lib
  44. HINTS
  45. $ENV{MRUBY_DIR}
  46. PATH_SUFFIXES lib64 lib
  47. PATHS
  48. ~/Library/Frameworks
  49. /Library/Frameworks
  50. /usr/local
  51. /usr
  52. /sw
  53. /opt/local
  54. /opt/csw
  55. /opt
  56. )
  57. IF(MRUBY_LIBRARY)
  58. # include the math library for Unix
  59. IF(UNIX AND NOT APPLE)
  60. FIND_LIBRARY(MRUBY_MATH_LIBRARY m)
  61. SET(MRUBY_LIBRARIES "${MRUBY_LIBRARY};${MRUBY_MATH_LIBRARY}" CACHE STRING "MRuby Libraries")
  62. # For Windows and Mac, don't need to explicitly include the math library
  63. ELSE(UNIX AND NOT APPLE)
  64. SET(MRUBY_LIBRARIES "${MRUBY_LIBRARY}" CACHE STRING "MRuby Libraries")
  65. ENDIF(UNIX AND NOT APPLE)
  66. ENDIF(MRUBY_LIBRARY)
  67. INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  68. # handle the QUIETLY and REQUIRED arguments and set MRUBY_FOUND to TRUE if
  69. # all listed variables are TRUE
  70. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Mruby DEFAULT_MSG MRUBY_LIBRARIES MRUBY_INCLUDE_DIR)
  71. MARK_AS_ADVANCED(MRUBY_INCLUDE_DIR MRUBY_LIBRARIES MRUBY_LIBRARY MRUBY_MATH_LIBRARY)