You need to create CMakeLists.txt
so that CLion is happy. It is enough to declare all the source files, you do not need to convert your scons (or any other build system) to cmake.
You donβt even need to write CMakeLists.txt manually, you can ask CLion to do this:
File | New CMake Project from Sources...
File | New CMake Project from Sources...
(since CLion 2019.2)File | Import project ... |
(old CLion)
and then specify the directory containing your project.
Now edit the generated CMakeLists.txt
and add the cmake command to tell CLion where to look for inclusions (in fact, to tell the compiler, and CLion will reuse this information).
Since your source files use include as #include "my_includes/my_own.hpp"
, you must specify cmake the base directory containing the my_includes
directory:
include_directories(.)
Where dot means the same directory as the directory containing CMakeLists.txt
.
I tested a project reproducing your layout and from my_src.cpp
I can go to my_own.hpp
.
Then for assembly you still have to use scons in the console. You can also add the cmake command, add_custom_target()
, which will call your scons (or your make, or whatever) so that you can also go from CLion to build errors.
source share