我将cmakelists.txt代码改为
cmake_minimum_required(VERSION 3.24)
project(Workplace)
set(CMAKE_CXX_STANDARD 98)
#递归遍历所有的cpp文件
file (GLOB_RECURSE files *.cpp LeetCode Meet\\*.cpp)
#将所有的cpp文件单独生成可执行文件
foreach (file ${files})
string(REGEX REPLACE ".+/(.+)\\..*" "\\1" exe ${file})
add_executable (${exe} ${file} )
message (\ \ \ \ --\ src/${exe}.cpp\ will\ be\ compiled\ to\ bin/${exe})
endforeach ()
之后,每次运行一个cpp文件,就会产生对应的exe文件在vmakelists同目录下
非常的不美观,想问如何禁止生成exe文件,或把其改到其他文件夹中去