Issue
How can I make CLion automatically copy my compiled executable to a specified directory after each build?
Since CLion uses CMake, I guess this should be possible with some CMake command in the CMakeLists.txt file. But I don't know how to do it.
Solution
I don't know about CLion but generally you can add this as a post-build step to an executable target in CMake with:
add_executable(MyExe ...)
add_custom_command(TARGET MyExe
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:MyExe> SomeOtherDir)
See e.g. Copy target file to another location in a post build step in CMake
Answered By - Florian Answer Checked By - Willingham (WPSolving Volunteer)