Browse Source

Merge topic 'add-dl-to-lua-static-linking'

adc04afe FindLua: Add dl library to Lua static library linking
Brad King 9 years ago
parent
commit
6b4b8e6a60
1 changed files with 7 additions and 0 deletions
  1. 7 0
      Modules/FindLua.cmake

+ 7 - 0
Modules/FindLua.cmake

@@ -172,6 +172,13 @@ 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}")