[Tarantool-patches] [PATCH 1/3] build: fix lua.c file generation

Igor Munkin imun at tarantool.org
Thu Feb 4 02:22:15 MSK 2021


If Lua source path given to <lua_source> function is relative, the
output file is generated in the binary directory. At the same time if
the given path to be compiled to *.lua.c is absolute, the output
file is generated in source directory instead of the binary one. This
patch fixes the latter case providing the valid behaviour for out of
source build type.

Needed for #4862

Signed-off-by: Igor Munkin <imun at tarantool.org>
---
 cmake/utils.cmake | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cmake/utils.cmake b/cmake/utils.cmake
index eaec821b3..6d6960468 100644
--- a/cmake/utils.cmake
+++ b/cmake/utils.cmake
@@ -40,9 +40,11 @@ endmacro(set_source_files_compile_flags)
 # A helper function to compile *.lua source into *.lua.c sources
 function(lua_source varname filename)
     if (IS_ABSOLUTE "${filename}")
+        string (REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}"
+            genname "${filename}")
         set (srcfile "${filename}")
-        set (tmpfile "${filename}.new.c")
-        set (dstfile "${filename}.c")
+        set (tmpfile "${genname}.new.c")
+        set (dstfile "${genname}.c")
     else(IS_ABSOLUTE "${filename}")
         set (srcfile "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
         set (tmpfile "${CMAKE_CURRENT_BINARY_DIR}/${filename}.new.c")
-- 
2.25.0



More information about the Tarantool-patches mailing list