diff options
author | Deniz Bahadir <dbahadir@benocs.com> | 2017-10-19 12:31:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-10-24 12:14:47 (GMT) |
commit | 4e7f67383f297d708efbb6640c9bee188a127d4e (patch) | |
tree | 4aba6cacdf3974f6bfbb4cb5908a37011a5ed33c /Source/cmAddExecutableCommand.cxx | |
parent | 6e4e7c6547fb4d379d564340d015af20e4a4e892 (diff) | |
download | CMake-4e7f67383f297d708efbb6640c9bee188a127d4e.zip CMake-4e7f67383f297d708efbb6640c9bee188a127d4e.tar.gz CMake-4e7f67383f297d708efbb6640c9bee188a127d4e.tar.bz2 |
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
Diffstat (limited to 'Source/cmAddExecutableCommand.cxx')
-rw-r--r-- | Source/cmAddExecutableCommand.cxx | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index 1d0376f..262e3a1 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -18,7 +18,7 @@ class cmExecutionStatus; bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus&) { - if (args.size() < 2) { + if (args.empty()) { this->SetError("called with incorrect number of arguments"); return false; } @@ -191,12 +191,6 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args, } } - if (s == args.end()) { - this->SetError( - "called with incorrect number of arguments, no sources provided"); - return false; - } - std::vector<std::string> srclists(s, args.end()); cmTarget* tgt = this->Makefile->AddExecutable(exename.c_str(), srclists, excludeFromAll); |