I am working on some c++ stuff and I hate having to create a whole new project just to run a few things on a file.
I also don\'t like how when you creat
CLion is based on CMake. So if you want to not use CMake, you can use other editors like Sublime Text.
But a simple CMake script could solve the problem.
The following CMake script automatically adds cpp
files in the current directory and its subdirectories to executables (filename as the target name).
cmake_minimum_required(VERSION 3.15)
project(MyApp)
set(CMAKE_CXX_STANDARD 17)
file(GLOB APP_SOURCES *.cpp */*.cpp)
foreach (testsourcefile ${APP_SOURCES})
get_filename_component(testname ${testsourcefile} NAME_WE)
message("${testname}")
add_executable(${testname} ${testsourcefile})
endforeach (testsourcefile ${APP_SOURCES})