[CMake] Interface targets with their own project in Visual Studio

Robert Dailey rcdailey.lists at gmail.com
Tue Jul 19 10:38:37 EDT 2016


Hello,

I'd like to define an INTERFACE library that has header files only but
still generates its own project in Visual Studio. The only way to add
headers to an interface target that I'm aware of is
target_source_files(), which instead of creating a project it will
cause the header files themselves to propagate to the actual targets
that specify the interface target as a link dependency.

Is there a way to change this behavior?

If not, the only workaround I can think of is pretty old-school:
add_custom_target(), but if I use that I'm not sure I can specify
include directories and preprocessor definitions that will be
inherited by dependencies. So it seems like I'm forced to choose one
or the other.


More information about the CMake mailing list