lua-openssl icon indicating copy to clipboard operation
lua-openssl copied to clipboard

Link against the Lua library on Unix/Linux

Open mikma opened this issue 1 year ago • 0 comments

Is there a reason not to link against ${LUA_LIBRARIES} on Unix/Linux as is done on Windows?

When you link with all required libraries then you have the option to include -Wl,--no-undefined in the module linker flags. This means undefined symbols can be detected during build-time, instead of during runtime, which I think is an advantage:

cmake -D CMAKE_MODULE_LINKER_FLAGS="-Wl,--no-undefined" .

My proposed solution to link against the Lua library on Unix/Linux:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b35907a..72d978b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,7 +87,7 @@ target_link_libraries(lua-openssl PUBLIC
     Threads::Threads
 )
 
-if(WIN32)
+if(WIN32 OR UNIX)
     target_link_libraries(lua-openssl PUBLIC
         ${LUA_LIBRARIES}
     )

mikma avatar Dec 20 '23 13:12 mikma