cmake/Source/cmLinkLibrariesCommand.cxx

42 lines
1.3 KiB
C++
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmLinkLibrariesCommand.h"
2017-04-14 19:02:05 +02:00
#include "cmMakefile.h"
class cmExecutionStatus;
// cmLinkLibrariesCommand
2016-07-09 11:21:54 +02:00
bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
cmExecutionStatus&)
{
2016-10-30 18:24:19 +01:00
if (args.empty()) {
return true;
2016-07-09 11:21:54 +02:00
}
2013-03-16 19:13:01 +02:00
// add libraries, nothe that there is an optional prefix
// of debug and optimized than can be used
2016-07-09 11:21:54 +02:00
for (std::vector<std::string>::const_iterator i = args.begin();
i != args.end(); ++i) {
if (*i == "debug") {
++i;
2016-07-09 11:21:54 +02:00
if (i == args.end()) {
this->SetError("The \"debug\" argument must be followed by "
"a library");
return false;
}
2017-04-14 19:02:05 +02:00
this->Makefile->AppendProperty("LINK_LIBRARIES", "debug");
2016-07-09 11:21:54 +02:00
} else if (*i == "optimized") {
++i;
2016-07-09 11:21:54 +02:00
if (i == args.end()) {
this->SetError("The \"optimized\" argument must be followed by "
"a library");
return false;
}
2017-04-14 19:02:05 +02:00
this->Makefile->AppendProperty("LINK_LIBRARIES", "optimized");
}
2017-04-14 19:02:05 +02:00
this->Makefile->AppendProperty("LINK_LIBRARIES", i->c_str());
2016-07-09 11:21:54 +02:00
}
2013-03-16 19:13:01 +02:00
return true;
}