FindLua.cmake 850 B

12345678910111213141516171819202122232425262728
  1. # Look for Lua library to use
  2. # This selects LuaJIT by default
  3. option(ENABLE_LUAJIT "Enable LuaJIT support" TRUE)
  4. set(USE_LUAJIT FALSE)
  5. option(REQUIRE_LUAJIT "Require LuaJIT support" FALSE)
  6. if(REQUIRE_LUAJIT)
  7. set(ENABLE_LUAJIT TRUE)
  8. endif()
  9. if(ENABLE_LUAJIT)
  10. find_package(LuaJIT)
  11. if(LUAJIT_FOUND)
  12. set(USE_LUAJIT TRUE)
  13. message (STATUS "Using LuaJIT provided by system.")
  14. elseif(REQUIRE_LUAJIT)
  15. message(FATAL_ERROR "LuaJIT not found whereas REQUIRE_LUAJIT=\"TRUE\" is used.\n"
  16. "To continue, either install LuaJIT or do not use REQUIRE_LUAJIT=\"TRUE\".")
  17. endif()
  18. else()
  19. message (STATUS "LuaJIT detection disabled! (ENABLE_LUAJIT=0)")
  20. endif()
  21. if(NOT USE_LUAJIT)
  22. message(STATUS "LuaJIT not found, using bundled Lua.")
  23. set(LUA_LIBRARY lua)
  24. set(LUA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/lua/src)
  25. add_subdirectory(lib/lua)
  26. endif()