r/lua • u/boris_gubanov • Aug 25 '25
Help Add lua lib in CMake project
Hello. I've started learning the C API, but I can't get my first project to run because I don't know how to add the library to my project (I'm really bad at CMake).
I'm using Windows 11, VSCode, and MSYS2 UCRT64. I tried downloading the compiled Win64_mingw6 library version and added the following lines to my CMakeLists.txt file:
target_include_directories(test-bg PRIVATE
${CMAKE_SOURCE_DIR}/liblua35/include
)
target_link_libraries(test-bg PRIVATE
${CMAKE_SOURCE_DIR}/liblua35/liblua53.a
)But it didn't work. Honestly, I don't really know what I'm doing, so I would appreciate any help.
4
Upvotes
View all comments
Show parent comment
1
u/boris_gubanov Aug 26 '25 edited Aug 26 '25
Thank you, you helped me a lot! I still don't fully understand why this happened (I don't really understand the difference between UCRT64 and Win64_mingw6), but I managed to build the project!
For future seekers:
make mingw local.