2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2006-02-19 23:25:27 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2006-02-19 23:25:27 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2006-02-19 23:25:27 +03:00
|
|
|
#include "cmInstallScriptGenerator.h"
|
|
|
|
|
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
|
|
|
}
|