cmake可以生成makefile,同时编写相对容易,并且在clion下的支持友好
cmake_minimum_required(VERSION 3.20)
project(demo)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -MMD -std=c++14") ## 添加-l flag
set(CMAKE_CXX_STANDARD 14) ## 设置c++14
include_directories(/usr/local/include/ /usr/local/include/lua) # 设置include的header库
link_directories(/usr/local/lib) # 设置lib库
add_executable(demo main.cpp) # 启动入口
target_sources(demo PUBLIC "src/lua_test.cpp") #设置sources
target_link_libraries(demo lua) # 添加link flag