CMake Nightly Date Stamp
[kiteware-cmake.git] / Source / CPack / cmCPackRPMGenerator.h
blob0e235039a094a7fbba1b90835987ca306a42b2fd
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 <string>
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
17 * CMake macros files.
19 class cmCPackRPMGenerator : public cmCPackGenerator
21 public:
22 cmCPackTypeMacro(cmCPackRPMGenerator, cmCPackGenerator);
24 /**
25 * Construct generator
27 cmCPackRPMGenerator();
28 ~cmCPackRPMGenerator() override;
30 static bool CanGenerate()
32 #ifdef __APPLE__
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();
38 #else
39 // legacy behavior on other systems
40 return true;
41 #endif
44 protected:
45 int InitializeInternal() override;
46 int PackageFiles() override;
47 /**
48 * This method factors out the work done in component packaging case.
50 int PackageOnePack(std::string const& initialToplevel,
51 std::string const& packageName);
52 /**
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);
58 /**
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();