aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules/FindLuaJIT.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/Modules/FindLuaJIT.cmake')
-rw-r--r--cmake/Modules/FindLuaJIT.cmake38
1 files changed, 25 insertions, 13 deletions
diff --git a/cmake/Modules/FindLuaJIT.cmake b/cmake/Modules/FindLuaJIT.cmake
index cd6e7bdd8..3f5cc1cf4 100644
--- a/cmake/Modules/FindLuaJIT.cmake
+++ b/cmake/Modules/FindLuaJIT.cmake
@@ -19,19 +19,31 @@ FIND_PATH(LUA_INCLUDE_DIR luajit.h
/opt
)
-FIND_LIBRARY(LUA_LIBRARY
- NAMES luajit-5.1
- HINTS
- $ENV{LUA_DIR}
- PATH_SUFFIXES lib64 lib
- PATHS
- ~/Library/Frameworks
- /Library/Frameworks
- /sw
- /opt/local
- /opt/csw
- /opt
-)
+# Test if running on vcpkg toolchain
+if(DEFINED VCPKG_TARGET_TRIPLET AND DEFINED VCPKG_APPLOCAL_DEPS)
+ # On vcpkg luajit is 'lua51' and normal lua is 'lua'
+ FIND_LIBRARY(LUA_LIBRARY
+ NAMES lua51
+ HINTS
+ $ENV{LUA_DIR}
+ PATH_SUFFIXES lib
+ )
+else()
+ FIND_LIBRARY(LUA_LIBRARY
+ NAMES luajit-5.1
+ HINTS
+ $ENV{LUA_DIR}
+ PATH_SUFFIXES lib64 lib
+ PATHS
+ ~/Library/Frameworks
+ /Library/Frameworks
+ /sw
+ /opt/local
+ /opt/csw
+ /opt
+ )
+endif()
+
IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/luajit.h")
FILE(STRINGS "${LUA_INCLUDE_DIR}/luajit.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"LuaJIT .+\"")