Defer check for sources within a target until generation.

The `add_library` and `add_executable` commands can now be called with
no source-files and won't generate a warning or error message, as long
as source-files will be added later via the `target_sources` command.
If during the generation step still no sources are associated with
targets created by such calls a useful error message will be generated
and generation fails.

Targets of type `INTERFACE_LIBRARY`, `UTILITY` or `GLOBAL_TARGET` are
excluded from this check because we do not need sources for these target
types during generation.

Fixes: #16872
This commit is contained in:
Deniz Bahadir
2017-10-19 14:31:10 +02:00
committed by Brad King
parent 6e4e7c6547
commit 4e7f67383f
24 changed files with 97 additions and 75 deletions
+2
View File
@@ -539,6 +539,8 @@ private:
virtual void ForceLinkerLanguages();
bool CheckTargetsForMissingSources() const;
void CreateLocalGenerators();
void CheckCompilerIdCompatibility(cmMakefile* mf,