2014-03-03 08:09:06 -07:00
|
|
|
# - Try to find luajit
|
|
|
|
# Once done this will define
|
|
|
|
# LUAJIT_FOUND - System has luajit
|
|
|
|
# LUAJIT_INCLUDE_DIRS - The luajit include directories
|
|
|
|
# LUAJIT_LIBRARIES - The libraries needed to use luajit
|
|
|
|
|
2019-06-27 17:02:19 -07:00
|
|
|
find_package(PkgConfig)
|
|
|
|
if (PKG_CONFIG_FOUND)
|
|
|
|
pkg_check_modules(PC_LUAJIT QUIET luajit)
|
2014-03-03 08:09:06 -07:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(LUAJIT_DEFINITIONS ${PC_LUAJIT_CFLAGS_OTHER})
|
|
|
|
|
|
|
|
find_path(LUAJIT_INCLUDE_DIR luajit.h
|
|
|
|
PATHS ${PC_LUAJIT_INCLUDEDIR} ${PC_LUAJIT_INCLUDE_DIRS}
|
2019-07-04 06:19:25 -07:00
|
|
|
PATH_SUFFIXES luajit-2.0 luajit-2.1)
|
2014-03-03 08:09:06 -07:00
|
|
|
|
2014-12-02 05:34:50 -07:00
|
|
|
# If we're asked to use static linkage, add libluajit-5.1.a as a preferred
|
|
|
|
# library name.
|
2014-03-03 08:09:06 -07:00
|
|
|
if(LUAJIT_USE_STATIC)
|
|
|
|
list(APPEND LUAJIT_NAMES
|
|
|
|
"${CMAKE_STATIC_LIBRARY_PREFIX}luajit-5.1${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
|
|
|
endif()
|
|
|
|
|
2014-07-14 17:10:27 -07:00
|
|
|
if(MSVC)
|
|
|
|
list(APPEND LUAJIT_NAMES lua51)
|
|
|
|
elseif(MINGW)
|
2015-10-16 17:06:04 -07:00
|
|
|
list(APPEND LUAJIT_NAMES libluajit libluajit-5.1)
|
2014-07-14 17:10:27 -07:00
|
|
|
else()
|
|
|
|
list(APPEND LUAJIT_NAMES luajit-5.1)
|
|
|
|
endif()
|
2014-03-03 08:09:06 -07:00
|
|
|
|
2014-07-14 17:10:27 -07:00
|
|
|
find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES}
|
2019-06-27 17:02:19 -07:00
|
|
|
PATHS ${PC_LUAJIT_LIBDIR} ${PC_LUAJIT_LIBRARY_DIRS})
|
2014-03-03 08:09:06 -07:00
|
|
|
|
|
|
|
set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY})
|
|
|
|
set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR})
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE
|
|
|
|
# if all listed variables are TRUE
|
|
|
|
find_package_handle_standard_args(LuaJit DEFAULT_MSG
|
|
|
|
LUAJIT_LIBRARY LUAJIT_INCLUDE_DIR)
|
|
|
|
|
|
|
|
mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARY)
|