cmake/Source/cmInstallGenerator.h

79 lines
2.4 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmInstallGenerator_h
#define cmInstallGenerator_h
2018-01-26 17:06:56 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-10-30 18:24:19 +01:00
#include <iosfwd>
#include <string>
#include <vector>
2020-02-01 23:06:01 +01:00
#include "cmInstallType.h"
#include "cmScriptGenerator.h"
class cmLocalGenerator;
2015-04-27 22:25:09 +02:00
class cmMakefile;
/** \class cmInstallGenerator
* \brief Support class for generating install scripts.
*
*/
2016-07-09 11:21:54 +02:00
class cmInstallGenerator : public cmScriptGenerator
{
public:
2015-04-27 22:25:09 +02:00
enum MessageLevel
{
MessageDefault,
MessageAlways,
MessageLazy,
MessageNever
};
2020-08-30 11:54:41 +02:00
cmInstallGenerator(std::string destination,
std::vector<std::string> const& configurations,
2020-08-30 11:54:41 +02:00
std::string component, MessageLevel message,
2016-07-09 11:21:54 +02:00
bool exclude_from_all);
2018-01-26 17:06:56 +01:00
~cmInstallGenerator() override;
2019-11-11 23:01:05 +01:00
cmInstallGenerator(cmInstallGenerator const&) = delete;
cmInstallGenerator& operator=(cmInstallGenerator const&) = delete;
virtual bool HaveInstall();
virtual void CheckCMP0082(bool& haveSubdirectoryInstall,
bool& haveInstallAfterSubdirectory);
2016-10-30 18:24:19 +01:00
void AddInstallRule(
std::ostream& os, std::string const& dest, cmInstallType type,
std::vector<std::string> const& files, bool optional = false,
2018-01-26 17:06:56 +01:00
const char* permissions_file = nullptr,
const char* permissions_dir = nullptr, const char* rename = nullptr,
const char* literal_args = nullptr, Indent indent = Indent());
/** Get the install destination as it should appear in the
installation script. */
2015-08-17 11:37:30 +02:00
std::string ConvertToAbsoluteDestination(std::string const& dest) const;
/** Test if this generator installs something for a given configuration. */
2015-04-27 22:25:09 +02:00
bool InstallsForConfig(const std::string& config);
/** Select message level from CMAKE_INSTALL_MESSAGE or 'never'. */
static MessageLevel SelectMessageLevel(cmMakefile* mf, bool never = false);
2019-11-11 23:01:05 +01:00
virtual bool Compute(cmLocalGenerator*) { return true; }
2015-11-17 17:22:37 +01:00
protected:
2018-01-26 17:06:56 +01:00
void GenerateScript(std::ostream& os) override;
2020-08-30 11:54:41 +02:00
std::string CreateComponentTest(const std::string& component,
2016-07-09 11:21:54 +02:00
bool exclude_from_all);
// Information shared by most generator types.
2020-08-30 11:54:41 +02:00
std::string const Destination;
std::string const Component;
MessageLevel const Message;
bool const ExcludeFromAll;
};
#endif