61 lines
1.7 KiB
CMake
61 lines
1.7 KiB
CMake
|
# - Find LUA
|
||
|
# Find the native LUA headers
|
||
|
#
|
||
|
# LUA_INCLUDE_DIR - where to find LUA.h, etc.
|
||
|
# LUA_LIBRARIES - LUA library
|
||
|
# LUA_FOUND - True if LUA found.
|
||
|
|
||
|
IF(LUA_FOUND)
|
||
|
# Already in cache, be silent
|
||
|
SET(LUA_FIND_QUIETLY TRUE)
|
||
|
ENDIF()
|
||
|
|
||
|
IF(BUILD_LUA OR ACGL_GLOBAL_EXTERN_DIR_FOUND_FIRST_TIME OR BUILD_TYPE_CHANGED)
|
||
|
UNSET(LUA_INCLUDE_DIR CACHE)
|
||
|
UNSET(LUA_LIBRARIES CACHE)
|
||
|
ENDIF()
|
||
|
|
||
|
IF(BUILD_LUA)
|
||
|
SET(LUA_INCLUDE_DIR "${ACGL_LOCAL_EXTERN_DIR}/lua/src")
|
||
|
SET(LUA_LIBRARIES lua${COMPILE_POSTFIX})
|
||
|
ELSE()
|
||
|
# Look for the header file.
|
||
|
IF(ACGL_GLOBAL_EXTERN_DIR)
|
||
|
FIND_PATH(LUA_INCLUDE_DIR NAMES lua.h PATHS "${ACGL_GLOBAL_EXTERN_DIR}/lua/src" NO_DEFAULT_PATH)
|
||
|
ENDIF()
|
||
|
IF(NOT LUA_INCLUDE_DIR)
|
||
|
FIND_PATH(LUA_INCLUDE_DIR NAMES lua.h)
|
||
|
ENDIF()
|
||
|
|
||
|
# Look for the library file.
|
||
|
IF(ACGL_GLOBAL_EXTERN_DIR)
|
||
|
FIND_LIBRARY(LUA_LIBRARIES NAMES lua${COMPILE_POSTFIX} PATHS "${ACGL_GLOBAL_EXTERN_DIR}/lua/lib" NO_DEFAULT_PATH)
|
||
|
ENDIF()
|
||
|
IF(NOT LUA_LIBRARIES)
|
||
|
FIND_LIBRARY(LUA_LIBRARIES NAMES lua)
|
||
|
ENDIF()
|
||
|
ENDIF()
|
||
|
|
||
|
# Copy the results to the output variables.
|
||
|
IF(LUA_INCLUDE_DIR AND LUA_LIBRARIES)
|
||
|
SET(LUA_FOUND TRUE CACHE INTERNAL "")
|
||
|
ELSE()
|
||
|
SET(LUA_FOUND FALSE CACHE INTERNAL "")
|
||
|
ENDIF()
|
||
|
|
||
|
# Report the results.
|
||
|
IF(NOT LUA_FOUND)
|
||
|
SET(LUA_MESSAGE "LUA source was not found. Make sure LUA_INCLUDE_DIR AND LUA_LIBRARIES are set correctly.")
|
||
|
IF(LUA_FIND_REQUIRED)
|
||
|
MESSAGE(FATAL_ERROR "${LUA_MESSAGE}")
|
||
|
ELSEIF(NOT LUA_FIND_QUIETLY)
|
||
|
MESSAGE(STATUS "${LUA_MESSAGE}")
|
||
|
ENDIF()
|
||
|
ELSEIF(NOT LUA_FIND_QUIETLY)
|
||
|
MESSAGE(STATUS "Looking for LUA - found")
|
||
|
ENDIF()
|
||
|
|
||
|
MESSAGE(STATUS "LUA_INCLUDE_DIR:${LUA_INCLUDE_DIR}")
|
||
|
MESSAGE(STATUS "LUA_LIBRARIES:${LUA_LIBRARIES}")
|
||
|
|