CMakeList.txt/Clion中添加头文件和库
cmake_minimum_required(VERSION 3.6) project(capi_lua) include_directories(/usr/include) find_library(LUALIB lua /usr/lib) set(SOURCE_FILES main.c) add_executable(capi_lua ${SOURCE_FILES}) target_link_libraries(capi_lua ${LUALIB})
1.使用include_directories添加头文件目录,
2.find_library在某个目录下查找名字中包含lua的目录,并将结果赋值给LUALIB这个变量
需要先安装相应的动态库/静态库
3.target_link_libraries为capi_lua这个可执行文件添加库,