Files
exercises/CMakeLists.txt
T
2026-07-31 00:33:17 +08:00

15 lines
498 B
CMake
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
cmake_minimum_required(VERSION 3.10)
project(exercises)
# 设置 C++ 标准(例如 C++17
set(CMAKE_CXX_STANDARD 17)
# 递归查找当前目录下所有的 .cpp 文件
file(GLOB_RECURSE SOURCES "*.cpp")
# 遍历所有找到的 .cpp 文件,为每个文件单独创建一个可执行目标
foreach(source ${SOURCES})
# 获取文件名(不带扩展名)作为可执行文件的名字
get_filename_component(name ${source} NAME_WE)
add_executable(${name} ${source})
endforeach()