[cmake-developers] Header-only library targets

Tim Blechmann tim at klingt.org
Mon Jul 13 05:38:06 EDT 2015


> I've recently switched from CMake 2.8.12 to 3.2, full of enthusiasm that
> header-only libraries would now be better supported through the
> INTERFACE option/target. However, the support for header-only libraries
> isn't really great, in particular if you're using an IDE like Visual Studio.
> 
> The main problem is that if you define an INTERFACE target, there's no
> way to specify headers, and they won't show up in IDEs. There's
> workarounds with a custom target, but that's not really great for
> example to set dependencies, populate the include directory of the
> library or to INSTALL the target.

i'm sometimes using the workaround of generating a dummy cpp file and
use a static library instead of an interface library ... ugly hack, but
allows to populate msvc/xcode/qtcreator projects ...



More information about the cmake-developers mailing list