Using Swig and Lua

I’d like to use CMake to generate my Lua wrapper. I used this before to produce python wrapper. I can generate my wrapper.c by running Everything works fine, but I don’t get my wrapper.c. I use the following code:

cmake_minimum_required (VERSION 3.1)

project(lbus_bindings)

#set prefix
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
	set (CMAKE_INSTALL_PREFIX "/usr/local")
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
	set (CMAKE_INSTALL_PREFIX "/opt")
else ()
	set (CMAKE_INSTALL_PREFIX "/usr/local")
endif ()

FIND_PACKAGE(SWIG REQUIRED)

find_package(Lua 5.3)

INCLUDE(${SWIG_USE_FILE})

if (LUA_FOUND)
	include_directories("${LUA_INCLUDE_DIR}")
endif ()

#configure the compiler
set(CMAKE_C_FLAGS "-Wall -Wextra")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
set(CMAKE_C_FLAGS_RELEASE "-O2")

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
SET(CMAKE_SWIG_FLAGS "")
SWIG_ADD_LIBRARY(lbus LANGUAGE lua SOURCES lbus.i sensor_bind.c circ_buff.c lproto_l1_tty.c
serial.c lproto_debug.c lproto_l2.c debug.c lproto_sensors_common.c lib_crc.c)
SWIG_LINK_LIBRARIES(lbus ${LUA_LIBRARIES})

Your description is quite unclear…
What is exactly the error messages?
What is your environment (OS, CMake version, generator used, SWIG version)?

Okay. There is no error message. If I run swig by hand like this:

swig -lua lbus.i

I get the lbus_wrap.c file, which is what I need. However, if I run make, the file won’t generated.

It is on Debian stable,
$ uname -a
Linux jive 4.19.0-17-amd64 #1 SMP Debian 4.19.194-2 (2021-06-21) x86_64 GNU/Linux
$ swig -version

SWIG Version 3.0.12

Compiled with g++ [x86_64-pc-linux-gnu]

Configured options: +pcre

$ cmake -version
cmake version 3.13.4

I am unable to reproduce your problem.

Can you show the result of make VERBOSE=1 on a fresh cmake generation?