Add new C++ class to target not working with subdirectory CMakeLists.txt

My project is setup with several modules that are each built by their own CMakeLists.txt.  Each modules CMakeLists.txt is included in the root CMakeLists.txt using the add_subdirectory() function.  This all seems to work fine as far as building and getting CLion to build its caches.

What doesn't seem to work is that when I do New->C++ Class, there are no suitable targets found to add the class files to.  CLion does seem to know about all of my targets since they show up as Run targets.  I'm wondering if this is expected behavior given my setup (in which case I will file an enhancement request) or if I'm doing something wrong.

1 comment
Comment actions Permalink

I just added CPP-5616 because I was having a similar problem.  You may want to add more info to that issue about your problem if your setup is different.

It turned out I hadn't carefully examined the add dialog, and I had to check the box and pick a target.  Once I did that, it worked fine.


Please sign in to leave a comment.