FindLuaJIT.cmake 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Locate LuaJIT library
  2. # This module defines
  3. # LUAJIT_FOUND, if false, do not try to link to Lua
  4. # LUA_LIBRARY, where to find the lua library
  5. # LUA_INCLUDE_DIR, where to find lua.h
  6. #
  7. # This module is similar to FindLua51.cmake except that it finds LuaJit instead.
  8. FIND_PATH(LUA_INCLUDE_DIR luajit.h
  9. HINTS
  10. $ENV{LUA_DIR}
  11. PATH_SUFFIXES include/luajit-2.1 include/luajit-2.0 include/luajit-5_1-2.1 include/luajit-5_1-2.0 include luajit
  12. PATHS
  13. ~/Library/Frameworks
  14. /Library/Frameworks
  15. /sw # Fink
  16. /opt/local # DarwinPorts
  17. /opt/csw # Blastwave
  18. /opt
  19. )
  20. # Test if running on vcpkg toolchain
  21. if(DEFINED VCPKG_TARGET_TRIPLET AND DEFINED VCPKG_APPLOCAL_DEPS)
  22. # On vcpkg luajit is 'lua51' and normal lua is 'lua'
  23. FIND_LIBRARY(LUA_LIBRARY
  24. NAMES lua51
  25. HINTS
  26. $ENV{LUA_DIR}
  27. PATH_SUFFIXES lib
  28. )
  29. else()
  30. FIND_LIBRARY(LUA_LIBRARY
  31. NAMES luajit-5.1
  32. HINTS
  33. $ENV{LUA_DIR}
  34. PATH_SUFFIXES lib64 lib
  35. PATHS
  36. ~/Library/Frameworks
  37. /Library/Frameworks
  38. /sw
  39. /opt/local
  40. /opt/csw
  41. /opt
  42. )
  43. endif()
  44. INCLUDE(FindPackageHandleStandardArgs)
  45. # handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if
  46. # all listed variables exist
  47. FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJIT
  48. REQUIRED_VARS LUA_LIBRARY LUA_INCLUDE_DIR)
  49. MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARY)