Skip to content

Commit

Permalink
Fix Lua static library linking
Browse files Browse the repository at this point in the history
  • Loading branch information
oxidase authored and Patrick Niklaus committed Jan 19, 2017
1 parent c03b230 commit 75e0b5a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Expand Up @@ -497,7 +497,7 @@ else()
ENDIF()
ENDIF()

set(USED_LUA_LIBRARIES ${LUA_LIBRARY})
set(USED_LUA_LIBRARIES ${LUA_LIBRARIES})
add_dependency_includes(${LUA_INCLUDE_DIR})

# add a target to generate API documentation with Doxygen
Expand Down Expand Up @@ -776,4 +776,3 @@ foreach(header ${headers_to_check})
endforeach()
add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources})
set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir})

8 changes: 7 additions & 1 deletion cmake/FindLua.cmake
Expand Up @@ -172,12 +172,18 @@ if (LUA_LIBRARY)
if (UNIX AND NOT APPLE AND NOT BEOS)
find_library(LUA_MATH_LIBRARY m)
set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}")

# include dl library for statically-linked Lua library
get_filename_component(LUA_LIB_EXT ${LUA_LIBRARY} EXT)
if(LUA_LIB_EXT STREQUAL CMAKE_STATIC_LIBRARY_SUFFIX)
list(APPEND LUA_LIBRARIES ${CMAKE_DL_LIBS})
endif()

# For Windows and Mac, don't need to explicitly include the math library
else ()
set(LUA_LIBRARIES "${LUA_LIBRARY}")
endif ()
endif ()

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
Expand Down
3 changes: 2 additions & 1 deletion features/step_definitions/data.js
Expand Up @@ -245,8 +245,9 @@ module.exports = function () {
text += data + '\n';
} else {
text += 'local f = assert(io.open("' + lua_profiles_path + '/' + profile + '.lua", "r"))\n';
text += 'local m = assert(loadstring(f:read("*all") .. [[\n' + data + '\n]]))\n';
text += 'local s = f:read("*all") .. [[\n' + data + '\n]]\n';
text += 'f:close()\n';
text += 'local m = assert(loadstring and loadstring(s) or load(s))\n';
text += 'm()\n';
}
this.profileFile = this.profileCacheFile;
Expand Down

0 comments on commit 75e0b5a

Please sign in to comment.