summaryrefslogtreecommitdiffstats
path: root/Source/cmInstallScriptGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmInstallScriptGenerator.cxx')
-rw-r--r--Source/cmInstallScriptGenerator.cxx39
1 files changed, 39 insertions, 0 deletions
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx
new file mode 100644
index 0000000..f7e6e44
--- /dev/null
+++ b/Source/cmInstallScriptGenerator.cxx
@@ -0,0 +1,39 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#include "cmInstallScriptGenerator.h"
+
+#include "cmScriptGenerator.h"
+
+#include <ostream>
+#include <vector>
+
+cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script,
+ bool code,
+ const char* component,
+ bool exclude_from_all)
+ : cmInstallGenerator(nullptr, std::vector<std::string>(), component,
+ MessageDefault, exclude_from_all)
+ , Script(script)
+ , Code(code)
+{
+}
+
+cmInstallScriptGenerator::~cmInstallScriptGenerator()
+{
+}
+
+void cmInstallScriptGenerator::GenerateScript(std::ostream& os)
+{
+ Indent indent;
+ std::string component_test =
+ this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll);
+ os << indent << "if(" << component_test << ")\n";
+
+ if (this->Code) {
+ os << indent.Next() << this->Script << "\n";
+ } else {
+ os << indent.Next() << "include(\"" << this->Script << "\")\n";
+ }
+
+ os << indent << "endif()\n\n";
+}