Subdirectory that is just header files

I have a pain in the butt situation. I am stuck working with a very old makefile based make system (about 200 directories). Moving it to CMake is not a short term option.

Building is “fine” but debugging is really horrible as there is no “Project” with the files being debugged. Its just an old school makefile based system. No IDE integration. For Eclipse the typical soluition is to do the “auto import” of all files under the top source directory.

But Visual Studio really doesn’t have a counter. I have a solution that essentially creates a CMake solution/project files for each directory. It works great, except to solve that, I want the “build” step for each directory to call “make –J ” which I can get working using a custom target

But there are a number of directories, that are header files only. Meaning there is no build target.

add_library will not work, since it reports “can not determine linker” which is fully understandable. Is there any way to simply say, “this project creates a folder with just files in it, and there is nothing to build”



For header-only libraries, you would want an INTERFACE library: add_library(header_only INTERFACE ${headers}). I think more recent versions (3.18+?) have support for showing these in IDEs.

Thanks. I’ll look into that.


Examples you might want to look into: