2016-09-27 19:01:08 +00:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2001-01-18 16:20:24 +00:00
|
|
|
#include "cmLinkLibrariesCommand.h"
|
2001-01-05 16:41:20 +00:00
|
|
|
|
2016-10-19 06:54:18 +00:00
|
|
|
#include "cmMakefile.h"
|
|
|
|
|
|
|
|
class cmExecutionStatus;
|
|
|
|
|
2001-01-18 16:20:24 +00:00
|
|
|
// cmLinkLibrariesCommand
|
2016-05-16 14:34:04 +00:00
|
|
|
bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
|
|
|
|
cmExecutionStatus&)
|
2001-01-05 16:41:20 +00:00
|
|
|
{
|
2016-09-15 21:59:29 +00:00
|
|
|
if (args.empty()) {
|
2002-07-22 14:01:53 +00:00
|
|
|
return true;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2012-08-13 17:42:58 +00:00
|
|
|
// add libraries, nothe that there is an optional prefix
|
2001-04-26 20:22:53 +00:00
|
|
|
// of debug and optimized than can be used
|
2016-05-16 14:34:04 +00:00
|
|
|
for (std::vector<std::string>::const_iterator i = args.begin();
|
|
|
|
i != args.end(); ++i) {
|
|
|
|
if (*i == "debug") {
|
2001-04-26 20:22:53 +00:00
|
|
|
++i;
|
2016-05-16 14:34:04 +00:00
|
|
|
if (i == args.end()) {
|
2006-05-12 15:56:09 +00:00
|
|
|
this->SetError("The \"debug\" argument must be followed by "
|
|
|
|
"a library");
|
2004-07-29 15:45:14 +00:00
|
|
|
return false;
|
2001-04-26 20:22:53 +00:00
|
|
|
}
|
2016-10-07 18:13:37 +00:00
|
|
|
this->Makefile->AppendProperty("LINK_LIBRARIES", "debug");
|
2016-05-16 14:34:04 +00:00
|
|
|
} else if (*i == "optimized") {
|
2001-04-26 20:22:53 +00:00
|
|
|
++i;
|
2016-05-16 14:34:04 +00:00
|
|
|
if (i == args.end()) {
|
2006-05-12 15:56:09 +00:00
|
|
|
this->SetError("The \"optimized\" argument must be followed by "
|
|
|
|
"a library");
|
2004-07-29 15:45:14 +00:00
|
|
|
return false;
|
2001-04-26 20:22:53 +00:00
|
|
|
}
|
2016-10-07 18:13:37 +00:00
|
|
|
this->Makefile->AppendProperty("LINK_LIBRARIES", "optimized");
|
2001-01-05 16:41:20 +00:00
|
|
|
}
|
2016-10-07 18:13:37 +00:00
|
|
|
this->Makefile->AppendProperty("LINK_LIBRARIES", i->c_str());
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2012-08-13 17:42:58 +00:00
|
|
|
|
2001-01-05 16:41:20 +00:00
|
|
|
return true;
|
|
|
|
}
|