cmake/Source/cmInstallTargetGenerator.h

127 lines
4.2 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. */
2021-09-14 00:13:48 +02:00
#pragma once
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>
2015-11-17 17:22:37 +01:00
2020-02-01 23:06:01 +01:00
#include "cmInstallGenerator.h"
2021-09-14 00:13:48 +02:00
#include "cmInstallType.h"
2020-02-01 23:06:01 +01:00
#include "cmListFileCache.h"
#include "cmScriptGenerator.h"
2015-11-17 17:22:37 +01:00
class cmGeneratorTarget;
2016-10-30 18:24:19 +01:00
class cmLocalGenerator;
/** \class cmInstallTargetGenerator
* \brief Generate target installation rules.
*/
2016-07-09 11:21:54 +02:00
class cmInstallTargetGenerator : public cmInstallGenerator
{
public:
2019-11-11 23:01:05 +01:00
cmInstallTargetGenerator(
2020-08-30 11:54:41 +02:00
std::string targetName, std::string const& dest, bool implib,
std::string file_permissions,
std::vector<std::string> const& configurations,
std::string const& component, MessageLevel message, bool exclude_from_all,
bool optional, cmListFileBacktrace backtrace = cmListFileBacktrace());
2018-01-26 17:06:56 +01:00
~cmInstallTargetGenerator() override;
/** Select the policy for installing shared library linkable name
symlinks. */
enum NamelinkModeType
{
NamelinkModeNone,
NamelinkModeOnly,
NamelinkModeSkip
};
void SetNamelinkMode(NamelinkModeType mode) { this->NamelinkMode = mode; }
2015-04-27 22:25:09 +02:00
std::string GetInstallFilename(const std::string& config) const;
2017-07-20 19:35:53 +02:00
void GetInstallObjectNames(std::string const& config,
std::vector<std::string>& objects) const;
enum NameType
{
NameNormal,
NameImplib,
NameSO,
NameReal
};
2016-03-13 13:35:51 +01:00
static std::string GetInstallFilename(const cmGeneratorTarget* target,
2015-04-27 22:25:09 +02:00
const std::string& config,
NameType nameType = NameNormal);
2019-11-11 23:01:05 +01:00
bool Compute(cmLocalGenerator* lg) override;
2015-11-17 17:22:37 +01:00
cmGeneratorTarget* GetTarget() const { return this->Target; }
bool IsImportLibrary() const { return this->ImportLibrary; }
2015-08-17 11:37:30 +02:00
std::string GetDestination(std::string const& config) const;
2021-09-14 00:13:48 +02:00
struct Files
{
// Names or paths of files to be read from the source or build tree.
// The paths may be computed as [FromDir/] + From[i].
std::vector<std::string> From;
// Corresponding names of files to be written in the install directory.
// The paths may be computed as Destination/ + [ToDir/] + To[i].
std::vector<std::string> To;
// Prefix for all files in From.
std::string FromDir;
// Prefix for all files in To.
std::string ToDir;
NamelinkModeType NamelinkMode = NamelinkModeNone;
bool NoTweak = false;
bool UseSourcePermissions = false;
cmInstallType Type = cmInstallType();
};
Files GetFiles(std::string const& config) const;
bool GetOptional() const { return this->Optional; }
2019-11-11 23:01:05 +01:00
protected:
2016-10-30 18:24:19 +01:00
void GenerateScriptForConfig(std::ostream& os, const std::string& config,
2018-01-26 17:06:56 +01:00
Indent indent) override;
2017-07-20 19:35:53 +02:00
void PreReplacementTweaks(std::ostream& os, Indent indent,
2015-04-27 22:25:09 +02:00
const std::string& config,
std::string const& file);
2017-07-20 19:35:53 +02:00
void PostReplacementTweaks(std::ostream& os, Indent indent,
2015-04-27 22:25:09 +02:00
const std::string& config,
std::string const& file);
2017-07-20 19:35:53 +02:00
void AddInstallNamePatchRule(std::ostream& os, Indent indent,
2015-04-27 22:25:09 +02:00
const std::string& config,
const std::string& toDestDirPath);
2017-07-20 19:35:53 +02:00
void AddChrpathPatchRule(std::ostream& os, Indent indent,
2015-04-27 22:25:09 +02:00
const std::string& config,
std::string const& toDestDirPath);
2017-07-20 19:35:53 +02:00
void AddRPathCheckRule(std::ostream& os, Indent indent,
2015-04-27 22:25:09 +02:00
const std::string& config,
std::string const& toDestDirPath);
2013-03-16 19:13:01 +02:00
2017-07-20 19:35:53 +02:00
void AddStripRule(std::ostream& os, Indent indent,
const std::string& toDestDirPath);
2017-07-20 19:35:53 +02:00
void AddRanlibRule(std::ostream& os, Indent indent,
const std::string& toDestDirPath);
2017-07-20 19:35:53 +02:00
void AddUniversalInstallRule(std::ostream& os, Indent indent,
2016-03-13 13:35:51 +01:00
const std::string& toDestDirPath);
2020-02-01 23:06:01 +01:00
void IssueCMP0095Warning(const std::string& unescapedRpath);
2020-08-30 11:54:41 +02:00
std::string const TargetName;
2022-08-04 22:12:04 +02:00
cmGeneratorTarget* Target = nullptr;
2020-08-30 11:54:41 +02:00
std::string const FilePermissions;
NamelinkModeType NamelinkMode;
2020-08-30 11:54:41 +02:00
bool const ImportLibrary;
bool const Optional;
};