Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11100 for code/trunk


Ignore:
Timestamp:
Jan 28, 2016, 3:56:24 PM (9 years ago)
Author:
muemart
Message:

Update FindLua5.1.cmake to work with newer versions. Also added another path suffix for include directories.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/cmake/tools/FindLua5.1.cmake

    r8351 r11100  
    3131INCLUDE(HandleLibraryTypes)
    3232
    33 # Macro that determines Lua version. Should work for versions 2.2 and above (current release: 5.1.4)
     33# Macro that determines Lua version. Should work for versions 2.2 and above (current release: 5.3.2)
    3434FUNCTION(DETERMINE_LUA_VERSION _file _varname)
    3535  IF(EXISTS ${_file})
     
    4444    STRING(REGEX REPLACE "^.*LUA_VERSION[ \t]+\"Lua[ \t]+([.0-9]+)\".*$" "\\1" ${_varname} "${_file_content}")
    4545    IF(${_varname} STREQUAL "${_file_content}")
    46       MESSAGE(FATAL_ERROR "Could not determine Lua version which means this script has a bug")
     46      # Last chance, search for LUA_VERSION_MAJOR and LUA_VERSION_MINOR
     47      STRING(REGEX REPLACE "^.*LUA_VERSION_MAJOR[ \t]+\"([0-9]+)\".*$" "\\1" _major "${_file_content}")
     48      STRING(REGEX REPLACE "^.*LUA_VERSION_MINOR[ \t]+\"([0-9]+)\".*$" "\\1" _minor "${_file_content}")
     49      IF(_major STREQUAL "${_file_content}" OR _minor STREQUAL "${_file_content}")
     50        MESSAGE(FATAL_ERROR "Could not determine Lua version which means this script has a bug")
     51      ENDIF()
     52      SET(${_varname} "${_major}.${_minor}")
    4753    ENDIF()
    4854    IF(${_varname} MATCHES "^[0-9]+\\.[0-9]+$")
     
    5763FIND_PATH(LUA5.1_INCLUDE_DIR lua.h
    5864  PATHS $ENV{LUA5.1_DIR} $ENV{LUA_DIR}
    59   PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
     65  PATH_SUFFIXES lua5.1 include/lua51 include/lua5.1 include/lua include
    6066)
    6167
Note: See TracChangeset for help on using the changeset viewer.