Add the REQUIRE_LUAJIT option (#5526)
authorYuGiOhJCJ <yugiohjcj@1s.fr>
Fri, 7 Apr 2017 05:29:43 +0000 (07:29 +0200)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Fri, 7 Apr 2017 05:29:43 +0000 (07:29 +0200)
lib/CMakeLists.txt

index 32d91472003c18b814446e63e38d7b48da029991..bc398f607065bc158b15d972165803ddc1d53f60 100644 (file)
@@ -1,13 +1,20 @@
 # LuaJIT
 option(ENABLE_LUAJIT "Enable LuaJIT support" TRUE)
 set(USE_LUAJIT FALSE PARENT_SCOPE)
+option(REQUIRE_LUAJIT "Require LuaJIT support" FALSE)
+if(REQUIRE_LUAJIT)
+       set(ENABLE_LUAJIT TRUE)
+endif()
 if(ENABLE_LUAJIT)
        find_package(LuaJIT)
        if(LUAJIT_FOUND)
                set(USE_LUAJIT TRUE)
                set(USE_LUAJIT TRUE PARENT_SCOPE)
                message (STATUS "Using LuaJIT provided by system.")
-       endif(LUAJIT_FOUND)
+       elseif(REQUIRE_LUAJIT)
+               message(FATAL_ERROR "LuaJIT not found whereas REQUIRE_LUAJIT=\"TRUE\" is used.\n"
+                       "To continue, either install LuaJIT or do not use REQUIRE_LUAJIT=\"TRUE\".")
+       endif()
 else()
        message (STATUS "LuaJIT detection disabled! (ENABLE_LUAJIT=0)")
 endif()