1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
5 #include "cmConfigure.h" // IWYU pragma: keep
9 #include "cmCPackGenerator.h"
11 /** \class cmCPackRPMGenerator
12 * \brief A generator for RPM packages
13 * The idea of the CPack RPM generator is to use
14 * as minimal C++ code as possible.
15 * Ideally the C++ part of the CPack RPM generator
16 * will only 'execute' (aka ->ReadListFile) several
19 class cmCPackRPMGenerator
: public cmCPackGenerator
22 cmCPackTypeMacro(cmCPackRPMGenerator
, cmCPackGenerator
);
27 cmCPackRPMGenerator();
28 ~cmCPackRPMGenerator() override
;
30 static bool CanGenerate()
33 // on MacOS enable CPackRPM iff rpmbuild is found
34 std::vector
<std::string
> locations
;
35 locations
.emplace_back("/sw/bin"); // Fink
36 locations
.emplace_back("/opt/local/bin"); // MacPorts
37 return !cmSystemTools::FindProgram("rpmbuild").empty();
39 // legacy behavior on other systems
45 int InitializeInternal() override
;
46 int PackageFiles() override
;
48 * This method factors out the work done in component packaging case.
50 int PackageOnePack(std::string
const& initialToplevel
,
51 std::string
const& packageName
);
53 * The method used to package files when component
54 * install is used. This will create one
55 * archive for each component group.
57 int PackageComponents(bool ignoreGroup
);
59 * Special case of component install where all
60 * components will be put in a single installer.
62 int PackageComponentsAllInOne(const std::string
& compInstDirName
);
63 const char* GetOutputExtension() override
{ return ".rpm"; }
64 std::string
GetSanitizedDirOrFileName(const std::string
& name
,
65 bool isFullName
= true) const override
;
66 bool SupportsComponentInstallation() const override
;
67 std::string
GetComponentInstallSuffix(
68 const std::string
& componentName
) override
;
69 std::string
GetComponentInstallDirNameSuffix(
70 const std::string
& componentName
) override
;
72 void AddGeneratedPackageNames();