在CmakeList.txt 中加入add_executable就可以了
add_executable(test2 test2/main2.cpp)
另外,也可以用子目录的方式
add_subdirectory(test2)
在子目录中同样需要创建新的CmakeList.txt 并加入add_executable
add_executable(test2 main2.cpp)
https://blog.csdn.net/ShawnAtCSDB/article/details/78785602
https://blog.csdn.net/gaowu959/article/details/78484725