diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-11-28 18:28:47 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-28 18:28:47 +0000 |
commit | 413cdcfd2d3563172d87b6f18a7adcb1c9660ec1 (patch) | |
tree | d22c68918283cc57b6bd0299586c5458234ffb6a /cmake | |
parent | db68f055ebdcf221dce13dd10dfff1d881023f84 (diff) | |
parent | ea6f08a5645b6ceb88a4a8142062cc51a29f0f90 (diff) | |
download | rspamd-413cdcfd2d3563172d87b6f18a7adcb1c9660ec1.tar.gz rspamd-413cdcfd2d3563172d87b6f18a7adcb1c9660ec1.zip |
Merge pull request #1196 from cryptomilk/master-cmake
cmake: Use Find Modules to find Luajit and Lua
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/FindLuaJIT.cmake | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/cmake/Modules/FindLuaJIT.cmake b/cmake/Modules/FindLuaJIT.cmake new file mode 100644 index 000000000..432aabb12 --- /dev/null +++ b/cmake/Modules/FindLuaJIT.cmake @@ -0,0 +1,71 @@ +# - Try to find LuaJIT +# Once done this will define +# +# LUAJIT_FOUND - system has LuaJIT +# LUAJIT_INCLUDE_DIR - the LuaJIT include directory +# LUAJIT_LIBRARIES - Link these to use LuaJIT +# LUAJIT_DEFINITIONS - Compiler switches required for using LuaJIT +# +#============================================================================= +# Copyright (c) 2016 Andrea Schneider <asn@cryptomilk.org> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# + +if (UNIX) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(_LUAJIT luajit) + endif (PKG_CONFIG_FOUND) +endif (UNIX) + +set(_LUAJIT_ROOT_HINTS + ${RSPAMD_SEARCH_PATH} + ${LUAJIT_ROOT_DIR} + ENV LUAJIT_ROOT_DIR +) + +find_path(LUAJIT_INCLUDE_DIR + NAMES + luajit.h + PATHS + ${_LUAJIT_INCLUDEDIR} + HINTS + ${_LUAJIT_ROOT_HINTS} + PATH_SUFFIXES + luajit-5_1-2.0 + luajit-5_2-2.0 + luajit-5_3-2.0 +) + +find_library(LUAJIT_LIBRARY + NAMES + luajit + luajit-5.1 + luajit-5.2 + luajit-5.3 + HINTS + ${_LUAJIT_ROOT_HINTS} + PATHS + ${_LUAJIT_LIBDIR} +) + +if (LUAJIT_LIBRARY) + set(LUAJIT_LIBRARIES + ${LUAJIT_LIBRARIES} + ${LUAJIT_LIBRARY} + ) +endif (LUAJIT_LIBRARY) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LuaJIT DEFAULT_MSG LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR) + +# show the LUAJIT_INCLUDE_DIR and LUAJIT_LIBRARIES variables only in the advanced view +mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES) + |