hedgewars/CMakeLists.txt
changeset 9208 acb2492288e5
parent 9203 bcc25cb9b122
child 9224 bce8cf41d666
--- a/hedgewars/CMakeLists.txt	Wed Jun 12 09:49:46 2013 +0200
+++ b/hedgewars/CMakeLists.txt	Wed Jun 12 11:17:54 2013 +0200
@@ -172,6 +172,16 @@
     list(APPEND pascal_flags "-dPNG_SCREENSHOTS" "-Fl${PNG_LIBRARY_DIR}" "-k-L${PNG_LIBRARY_DIR}")
 endif()
 
+if(LUA_FOUND AND LUA_SYSTEM)
+    get_filename_component(LUA_LIBRARY_DIR ${LUA_LIBRARY} PATH)
+    get_filename_component(LUA_LIBRARY_NAME ${LUA_LIBRARY} NAME)
+    #NAME_WE would strip the .1 (or .2) next to the ".so"
+    string(REGEX REPLACE "${CMAKE_SHARED_LIBRARY_PREFIX}(.*)${CMAKE_SHARED_LIBRARY_SUFFIX}" "\\1" LUA_LIBRARY_NAME "${LUA_LIBRARY_NAME}")
+    list(APPEND pascal_flags )
+    list(APPEND pascal_flags "-Fl${LUA_LIBRARY_DIR}"
+                             "-k-L${LUA_LIBRARY_DIR}"
+                             "-XLAlua=${LUA_LIBRARY_NAME}")
+endif()
 
 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
 if(FREEPASCAL_VERSION VERSION_LESS "2.6")