1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
10 #include "cmCPackGenerator.h"
13 using cmCPackInnoSetupKeyValuePairs
= std::map
<std::string
, std::string
>;
15 class cmCPackComponentGroup
;
16 class cmCPackComponent
;
18 /** \class cmCPackInnoSetupGenerator
19 * \brief A generator for Inno Setup
21 * https://jrsoftware.org/isinfo.php
23 class cmCPackInnoSetupGenerator
: public cmCPackGenerator
26 cmCPackTypeMacro(cmCPackInnoSetupGenerator
, cmCPackGenerator
);
31 cmCPackInnoSetupGenerator();
32 ~cmCPackInnoSetupGenerator() override
;
34 static bool CanGenerate();
37 int InitializeInternal() override
;
38 int PackageFiles() override
;
40 inline const char* GetOutputExtension() override
{ return ".exe"; }
42 inline cmCPackGenerator::CPackSetDestdirSupport
SupportsSetDestdir()
45 return cmCPackGenerator::SETDESTDIR_UNSUPPORTED
;
48 inline bool SupportsAbsoluteDestination() const override
{ return false; }
49 inline bool SupportsComponentInstallation() const override
{ return true; }
58 bool ProcessSetupSection();
60 bool ProcessComponents();
62 bool ConfigureISScript();
65 bool BuildDownloadedComponentArchive(cmCPackComponent
* component
,
66 const std::string
& uploadDirectory
,
70 * Returns the option's value or an empty string if the option isn't set.
72 cmValue
RequireOption(const std::string
& key
);
74 std::string
CustomComponentInstallDirectory(
75 const cmCPackComponent
* component
);
78 * Translates boolean expressions into "yes" or "no", as required in
79 * Inno Setup (only if "CPACK_INNOSETUP_USE_CMAKE_BOOL_FORMAT" is on).
81 std::string
TranslateBool(const std::string
& value
);
84 * Creates a typical line of key and value pairs using the given map.
86 * (e.g.: Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}";
87 * GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked)
89 std::string
ISKeyValueLine(const cmCPackInnoSetupKeyValuePairs
& params
);
91 std::string
CreateRecursiveComponentPath(cmCPackComponentGroup
* group
,
92 const std::string
& path
= "");
94 void CreateRecursiveComponentGroups(cmCPackComponentGroup
* group
);
97 * These functions add quotes if the given value hasn't already quotes.
98 * Paths are converted into the format used by Windows before.
100 std::string
Quote(const std::string
& string
);
101 std::string
QuotePath(const std::string
& path
,
102 PathType type
= PathType::Windows
);
105 * This function replaces the following 5 characters with their %-encoding:
106 * '|' '}' ',' '%' '"'
107 * Required for Inno Setup constants like {cm:...}
109 std::string
PrepareForConstant(const std::string
& string
);
111 std::vector
<std::string
> includeDirectives
;
112 cmCPackInnoSetupKeyValuePairs setupDirectives
;
113 bool toplevelProgramFolder
;
114 std::vector
<std::string
> languageInstructions
;
115 std::vector
<std::string
> fileInstructions
;
116 std::vector
<std::string
> dirInstructions
;
117 std::vector
<std::string
> typeInstructions
;
118 std::vector
<std::string
> componentInstructions
;
119 std::vector
<std::string
> iconInstructions
;
120 std::vector
<std::string
> desktopIconComponents
;
121 std::vector
<std::string
> runInstructions
;
122 std::vector
<std::string
> codeIncludes
;