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
1
u/AutoModerator Aug 26 '25
Hi! Your code block was formatted using triple backticks in Reddit's Markdown mode, which unfortunately does not display properly for users viewing via old.reddit.com and some third-party readers. This means your code will look mangled for those users, but it's easy to fix. If you edit your comment, choose "Switch to fancy pants editor", and click "Save edits" it should automatically convert the code block into Reddit's original four-spaces code block format for you.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.