diff options
Diffstat (limited to 'Modules/FindLua51.cmake')
-rw-r--r-- | Modules/FindLua51.cmake | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake index e111d3624..eac25f526 100644 --- a/Modules/FindLua51.cmake +++ b/Modules/FindLua51.cmake @@ -1,6 +1,6 @@ # Locate Lua library # This module defines -# LUA51_FOUND, if false, do not try to link to Lua +# LUA51_FOUND, if false, do not try to link to Lua # LUA_LIBRARIES # LUA_INCLUDE_DIR, where to find lua.h # LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8) @@ -25,9 +25,9 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PATH(LUA_INCLUDE_DIR lua.h +find_path(LUA_INCLUDE_DIR lua.h HINTS - $ENV{LUA_DIR} + ENV LUA_DIR PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include PATHS ~/Library/Frameworks @@ -38,11 +38,11 @@ FIND_PATH(LUA_INCLUDE_DIR lua.h /opt ) -FIND_LIBRARY(LUA_LIBRARY +find_library(LUA_LIBRARY NAMES lua51 lua5.1 lua-5.1 lua HINTS - $ENV{LUA_DIR} - PATH_SUFFIXES lib64 lib + ENV LUA_DIR + PATH_SUFFIXES lib PATHS ~/Library/Frameworks /Library/Frameworks @@ -52,30 +52,30 @@ FIND_LIBRARY(LUA_LIBRARY /opt ) -IF(LUA_LIBRARY) +if(LUA_LIBRARY) # include the math library for Unix - IF(UNIX AND NOT APPLE) - FIND_LIBRARY(LUA_MATH_LIBRARY m) - SET( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries") + if(UNIX AND NOT APPLE) + find_library(LUA_MATH_LIBRARY m) + set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries") # For Windows and Mac, don't need to explicitly include the math library - ELSE(UNIX AND NOT APPLE) - SET( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries") - ENDIF(UNIX AND NOT APPLE) -ENDIF(LUA_LIBRARY) + else() + set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries") + endif() +endif() -IF(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") - FILE(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"") +if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") + file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"") - STRING(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}") - UNSET(lua_version_str) -ENDIF() + string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}") + unset(lua_version_str) +endif() -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if # all listed variables are TRUE FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51 REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR VERSION_VAR LUA_VERSION_STRING) -MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) +mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) |