Add INTERFACE libraries to generated buildsystem if they have SOURCES

INTERFACE libraries were created with the intention of collecting usage
requirements for use by other targets via `target_link_libraries`.
Therefore they were not allowed to have SOURCES and were not included in
the generated buildsystem.  In practice, this has become limiting:

* Header-only libraries do have sources, they just do not compile.
  Developers should be able to edit those sources (the header files)
  in their IDE.

* Header-only libraries may need to generate some of their header
  files via custom commands.

Some projects work around these limitations by pairing each interface
library with an `add_custom_target` that makes the header files and
custom commands appear in the generated buildsystem and in IDEs.

Lift such limitations by allowing INTERFACE libraries to have SOURCES.
For those with sources, add a corresponding build target to the
generated buildsystem.

Fixes: #19145
This commit is contained in:
Brad King
2020-07-20 13:19:26 -04:00
parent afb998704e
commit 4391913133
48 changed files with 303 additions and 94 deletions

View File

@@ -15,6 +15,12 @@
# error Expected IFACE_HEADER_BUILDDIR
#endif
#include "iface_genheader.h"
#ifndef IFACE_GENHEADER
# error Expected IFACE_GENHEADER
#endif
extern int obj();
extern int sub();
extern int item();