CMake Nightly Date Stamp
[kiteware-cmake.git] / Source / CPack / cmCPackNSISGenerator.h
blobded02debcb820efb3a40874ef889c57451e6870c
1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
3 #pragma once
5 #include "cmConfigure.h" // IWYU pragma: keep
7 #include <iosfwd>
8 #include <set>
9 #include <string>
10 #include <vector>
12 #include <cm/string_view>
14 #include "cmCPackGenerator.h"
16 class cmCPackComponent;
17 class cmCPackComponentGroup;
19 /** \class cmCPackNSISGenerator
20 * \brief A generator for NSIS files
22 * http://people.freebsd.org/~kientzle/libarchive/
24 class cmCPackNSISGenerator : public cmCPackGenerator
26 public:
27 cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenerator);
29 static cmCPackGenerator* CreateGenerator64()
31 return new cmCPackNSISGenerator(true);
34 /**
35 * Construct generator
37 cmCPackNSISGenerator(bool nsis64 = false);
38 ~cmCPackNSISGenerator() override;
40 protected:
41 int InitializeInternal() override;
42 void CreateMenuLinks(std::ostream& str, std::ostream& deleteStr);
43 int PackageFiles() override;
44 const char* GetOutputExtension() override { return ".exe"; }
45 const char* GetOutputPostfix() override { return "win32"; }
47 bool GetListOfSubdirectories(const char* dir,
48 std::vector<std::string>& dirs);
50 enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir()
51 const override;
52 bool SupportsAbsoluteDestination() const override;
53 bool SupportsComponentInstallation() const override;
55 /// Produce a string that contains the NSIS code to describe a
56 /// particular component. Any added macros will be emitted via
57 /// macrosOut.
58 std::string CreateComponentDescription(cmCPackComponent* component,
59 std::ostream& macrosOut);
61 /// Produce NSIS code that selects all of the components that this component
62 /// depends on, recursively.
63 std::string CreateSelectionDependenciesDescription(
64 cmCPackComponent* component, std::set<cmCPackComponent*>& visited);
66 /// Produce NSIS code that de-selects all of the components that are
67 /// dependent on this component, recursively.
68 std::string CreateDeselectionDependenciesDescription(
69 cmCPackComponent* component, std::set<cmCPackComponent*>& visited);
71 /// Produce a string that contains the NSIS code to describe a
72 /// particular component group, including its components. Any
73 /// added macros will be emitted via macrosOut.
74 std::string CreateComponentGroupDescription(cmCPackComponentGroup* group,
75 std::ostream& macrosOut);
77 /// Returns the custom install directory if available for the specified
78 /// component, otherwise $INSTDIR is returned.
79 std::string CustomComponentInstallDirectory(cm::string_view componentName);
81 /// Translations any newlines found in the string into \\r\\n, so that the
82 /// resulting string can be used within NSIS.
83 static std::string TranslateNewlines(std::string str);
85 bool Nsis64;