CMakeLists.txt
cmake_minimum_required(VERSION 3.15) project(test) # set(SRC add.cpp;div.cpp;mult.cpp;main.cpp;sub.cpp) # ${PROJECT_SOURCE_DIR}指定的就是cmakelists所在的路径 aux_source_directory(搜索路径) 方式一 # aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC) # 方式二 file(GLOB SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) # 添加动态库 include_directories(${PROJECT_SOURCE_DIR}/include) set(EXECUTABLE_OUTPUT_PATH ../output) set(CMAKE_CXX_STANDARD 11) add_executable(app ${SRC})