I'm trying to use Lua in my C++ program. My OS is Linux Manjaro 15.12. I downloaded the Lua 5.3 source code, and compiled it as C++ code (I really need the exception handling instead of longjmp), with this line:
make "CC=g++" linux
Then sudo make install to get Lua installed in /usr/local. Everything looks fine. My CMake version seems to be updated:
cmake --version
cmake version 3.4.1
In my CMake file, I find Lua like this:
find_package(Lua REQUIRED)
include_directories(${LUA_INCLUDE_DIR})
message(" *** Lua include: ${LUA_INCLUDE_DIR}")
message(" *** Lua lib: ${LUA_LIBRARIES}")
After running this command:
cd build
cmake -G "Unix Makefiles" ..
The include folder is properly detected in /usr/local/include, but the library itself, is found as /usr/lib64/liblua5.1.so;/usr/lib64/libm.so, wich is not the installation I did (and its version 5.1, I want 5.3). CMake says:
Found Lua: /usr/lib64/liblua5.1.so;/usr/lib64/libm.so (found version "5.3.2")
Its like it is "mixing" the two versions. Running make throws a lot of undefined references. Previously in my CMake file, I find other libraries (SDL2 compiled by me, OpenGL, glew), and they seem to work. The only errors I got are for the Lua library. Of course, I'm adding the libraries to my target_link_libraries command
How can I fix this? (I don't care if I have to eliminate the older Lua version, as long as it doesn't break my OS).