I'm working on a project that is structured this way:
"MyProject" is the main project, and "MyStaticLibrary" is a collection of .h/.cpp files that I include in the sources of "MyProject" and other projects. Some of the sources of "MyStaticLibrary" are header-only (just .h file). I don't want to move "MyStaticLibrary" into a subfolder of "MyProject".
To add the sources of "MyStaticLibrary" into "MyProject", I added the following to my CMakeLists.txt:
As you can see, "External Sources" shows only the .cpp file, and the .h files (array_helpers.h, dr_wav.h, piano.h, string_hammer.h) are absent. If I access these header files from CLion, I get the message "This file does not belong to any project target; code insight features might not work correctly". I'm able to compile the project, nevertheless this is very annoying. Another IDE (QtCreator) is able to show these header files as source, using the same exact CMakeLists.txt.
EDIT: following this guide, I've tried adding the include_directories() command. This has the effect of adding the library directory in "External Libraries", but the header files are still missing: