2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2006-02-19 23:25:27 +03:00
|
|
|
#include "cmInstallScriptGenerator.h"
|
|
|
|
|
2016-09-01 21:59:28 +03:00
|
|
|
#include "cmScriptGenerator.h"
|
|
|
|
|
|
|
|
#include <ostream>
|
|
|
|
#include <vector>
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script,
|
|
|
|
bool code,
|
|
|
|
const char* component,
|
|
|
|
bool exclude_from_all)
|
2016-06-27 23:44:16 +03:00
|
|
|
: cmInstallGenerator(CM_NULLPTR, std::vector<std::string>(), component,
|
2016-05-16 17:34:04 +03:00
|
|
|
MessageDefault, exclude_from_all)
|
|
|
|
, Script(script)
|
|
|
|
, Code(code)
|
2006-02-19 23:25:27 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
cmInstallScriptGenerator::~cmInstallScriptGenerator()
|
2006-02-19 23:25:27 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmInstallScriptGenerator::GenerateScript(std::ostream& os)
|
|
|
|
{
|
2007-10-15 15:08:15 +04:00
|
|
|
Indent indent;
|
|
|
|
std::string component_test =
|
2016-02-01 13:01:39 +03:00
|
|
|
this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll);
|
2013-08-22 13:30:19 +04:00
|
|
|
os << indent << "if(" << component_test << ")\n";
|
2007-10-15 15:08:15 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Code) {
|
2007-10-15 15:08:15 +04:00
|
|
|
os << indent.Next() << this->Script << "\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2013-08-22 13:30:19 +04:00
|
|
|
os << indent.Next() << "include(\"" << this->Script << "\")\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-10-15 15:08:15 +04:00
|
|
|
|
2013-08-22 13:30:19 +04:00
|
|
|
os << indent << "endif()\n\n";
|
2006-02-19 23:25:27 +03:00
|
|
|
}
|