本文主要是介绍简单的C++ CMake构建程序,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
简单版本:
cmake_minimum_required(VERSION 3.15)project(testP)include_directories(${PROJECT_SOURCE_DIR}/inc)add_executable(${PROJECT_NAME}
src/main.cpp
inc/hello.h
)
进阶版本:
cmake_minimum_required(VERSION 3.15)project(testP)include_directories(${PROJECT_SOURCE_DIR}/inc)file(GLOB_RECURSE user_cpps src/*.cpp)
file(GLOB_RECURSE user_headers inc/*.h)set(user
${user_headers}
${user_cpps})add_executable(${PROJECT_NAME}
${user}
)
这篇关于简单的C++ CMake构建程序的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!