简单版本:
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}
)