Guest User

Untitled

a guest
Jan 27th, 2013
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. # Locate Lua library
  2. # This module defines
  3. # LUA52_FOUND, if false, do not try to link to Lua
  4. # LUA_LIBRARIES
  5. # LUA_INCLUDE_DIR, where to find lua.h
  6. #
  7. # Note that the expected include convention is
  8. # #include "lua.h"
  9. # and not
  10. # #include <lua/lua.h>
  11. # This is because, the lua location is not standardized and may exist
  12. # in locations other than lua/
  13.  
  14. #=============================================================================
  15. # Copyright 2007-2009 Kitware, Inc.
  16. #
  17. # Distributed under the OSI-approved BSD License (the "License");
  18. # see accompanying file Copyright.txt for details.
  19. #
  20. # This software is distributed WITHOUT ANY WARRANTY; without even the
  21. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  22. # See the License for more information.
  23. #=============================================================================
  24. # (To distribute this file outside of CMake, substitute the full
  25. # License text for the above reference.)
  26.  
  27. find_path(LUA_INCLUDE_DIR lua.h
  28. HINTS
  29. $ENV{LUA_DIR}
  30. PATH_SUFFIXES include/lua52 include/lua5.2 include/lua include
  31. PATHS
  32. ~/Library/Frameworks
  33. /Library/Frameworks
  34. /usr/local
  35. /usr
  36. /sw # Fink
  37. /opt/local # DarwinPorts
  38. /opt/csw # Blastwave
  39. /opt
  40. )
  41.  
  42. find_library(LUA_LIBRARY
  43. NAMES lua52 lua5.2 lua-5.2 lua
  44. HINTS
  45. $ENV{LUA_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.  
  58. if(LUA_LIBRARY)
  59. # include the math library for Unix
  60. if(UNIX AND NOT APPLE)
  61. find_library(LUA_MATH_LIBRARY m)
  62. set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
  63. # For Windows and Mac, don't need to explicitly include the math library
  64. else()
  65. set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
  66. endif()
  67. endif()
  68.  
  69. if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
  70. file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
  71.  
  72. string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
  73. unset(lua_version_str)
  74. endif()
  75.  
  76. include(FindPackageHandleStandardArgs)
  77. # handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
  78. # all listed variables are TRUE
  79. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51
  80. REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
  81. VERSION_VAR LUA_VERSION_STRING)
  82.  
  83. mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
Advertisement
Add Comment
Please, Sign In to add comment