How to manage generated source files?


I am new to CLion and also new to this forum. So, my apology if this question has been asked in other threads before. I have tried to search for similar thread and found nothing.

The situation is as follows. In my project I have setup in such a way that when Lua build option is enabled then it instructs CMake to add optional process to generate Lua bindings source files on-the-fly and then uses those generated source files to build the complete library with Lua support for the project. In the context of out-of-source build, those generated source files are expected to be located in the build-tree (as opposed to my source-tree). And in the context of CLion IDE, this build-tree location is predetermined by CLion (and it is being considered as something internal to CLion, which is wrong if you asked me, but that's another issue). So, now my project has two places that contains source files. This is perfectly fine as the CMake-generated Makefile builds just fine as per normal. However, the CLion began to complain every time I open my project. The message was shown as a tooltip above the CMake tab near the status bar. The message was:
Some source files are located outside of CMakeLists.txt directory.
You can change the project root or ignore this in future
Clicking ignore this in future solves the superfluos tooltip message problem. But I still have two minor cosmetic issues with the generated source files:
1. The generated C++ implementation files (*.cpp) are listed individually in the "Project" view but outside of my source-tree folder. This is kind of expected, but it would be nicer if they are all grouped together, say, under a "generated" folder or something like that under the project folder.
2. The generated C++ header files (*.h) are not being listed at all in the "Project" view. However, the indexer seems able to find it. So this is just another cosmetic issue. It would be nicer if all the generated source files could be listed in one place.

So, how does one manage the generated source files in CLion? Am I missing something?

Please sign in to leave a comment.