cmake/Source/cmLocalGenerator.h

599 lines
25 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 cmLocalGenerator_h
#define cmLocalGenerator_h
2018-01-26 17:06:56 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-07-09 11:21:54 +02:00
2016-10-30 18:24:19 +01:00
#include <iosfwd>
#include <map>
2020-08-30 11:54:41 +02:00
#include <memory>
2016-10-30 18:24:19 +01:00
#include <set>
#include <string>
2018-01-26 17:06:56 +01:00
#include <unordered_map>
2016-10-30 18:24:19 +01:00
#include <vector>
2020-08-30 11:54:41 +02:00
#include <cm3p/kwiml/int.h>
2020-02-01 23:06:01 +01:00
2020-08-30 11:54:41 +02:00
#include "cmCustomCommandTypes.h"
2017-04-14 19:02:05 +02:00
#include "cmListFileCache.h"
2019-11-11 23:01:05 +01:00
#include "cmMessageType.h"
2017-04-14 19:02:05 +02:00
#include "cmOutputConverter.h"
#include "cmPolicies.h"
#include "cmStateSnapshot.h"
class cmComputeLinkInformation;
2016-10-30 18:24:19 +01:00
class cmCustomCommandGenerator;
2020-08-30 11:54:41 +02:00
class cmCustomCommandLines;
2013-03-16 19:13:01 +02:00
class cmGeneratorTarget;
2016-10-30 18:24:19 +01:00
class cmGlobalGenerator;
2020-08-30 11:54:41 +02:00
class cmImplicitDependsList;
2017-04-14 19:02:05 +02:00
class cmLinkLineComputer;
2016-10-30 18:24:19 +01:00
class cmMakefile;
2017-04-14 19:02:05 +02:00
class cmRulePlaceholderExpander;
class cmSourceFile;
2017-04-14 19:02:05 +02:00
class cmState;
2020-08-30 11:54:41 +02:00
class cmTarget;
2019-11-11 23:01:05 +01:00
class cmake;
/** \class cmLocalGenerator
* \brief Create required build files for a directory.
*
* Subclasses of this abstract class generate makefiles, DSP, etc for various
2012-02-18 12:40:36 +02:00
* platforms. This class should never be constructed directly. A
* GlobalGenerator will create it and invoke the appropriate commands on it.
*/
2015-11-17 17:22:37 +01:00
class cmLocalGenerator : public cmOutputConverter
{
public:
2015-11-17 17:22:37 +01:00
cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile);
virtual ~cmLocalGenerator();
2012-02-18 12:40:36 +02:00
/**
2012-02-18 12:40:36 +02:00
* Generate the makefile for this directory.
*/
virtual void Generate() {}
2015-11-17 17:22:37 +01:00
virtual void ComputeHomeRelativeOutputPath() {}
2012-02-18 12:40:36 +02:00
/**
* Calls TraceVSDependencies() on all targets of this generator.
*/
2013-03-16 19:13:01 +02:00
void TraceDependencies();
virtual void AddHelperCommands() {}
/**
* Generate the install rules files in this directory.
*/
2013-03-16 19:13:01 +02:00
void GenerateInstallRules();
/**
* Generate the test files for tests.
*/
2013-03-16 19:13:01 +02:00
void GenerateTestFiles();
/**
* Generate a manifest of target files that will be built.
*/
2015-11-17 17:22:37 +01:00
void ComputeTargetManifest();
2017-07-20 19:35:53 +02:00
bool ComputeTargetCompileFeatures();
2016-03-13 13:35:51 +01:00
bool IsRootMakefile() const;
2019-11-11 23:01:05 +01:00
//! Get the makefile for this generator
2016-07-09 11:21:54 +02:00
cmMakefile* GetMakefile() { return this->Makefile; }
2012-02-18 12:40:36 +02:00
2019-11-11 23:01:05 +01:00
//! Get the makefile for this generator, const version
2016-07-09 11:21:54 +02:00
const cmMakefile* GetMakefile() const { return this->Makefile; }
2012-02-18 12:40:36 +02:00
2019-11-11 23:01:05 +01:00
//! Get the GlobalGenerator this is associated with
2016-07-09 11:21:54 +02:00
cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; }
const cmGlobalGenerator* GetGlobalGenerator() const
{
return this->GlobalGenerator;
}
2017-04-14 19:02:05 +02:00
virtual cmRulePlaceholderExpander* CreateRulePlaceholderExpander() const;
std::string GetLinkLibsCMP0065(std::string const& linkLanguage,
cmGeneratorTarget& tgt) const;
2015-08-17 11:37:30 +02:00
cmState* GetState() const;
2017-04-14 19:02:05 +02:00
cmStateSnapshot GetStateSnapshot() const;
2015-08-17 11:37:30 +02:00
void AddArchitectureFlags(std::string& flags,
cmGeneratorTarget const* target,
2020-08-30 11:54:41 +02:00
const std::string& lang, const std::string& config,
const std::string& filterArch = std::string());
2010-03-17 14:00:29 +02:00
2017-07-20 19:35:53 +02:00
void AddLanguageFlags(std::string& flags, cmGeneratorTarget const* target,
const std::string& lang, const std::string& config);
void AddLanguageFlagsForLinking(std::string& flags,
cmGeneratorTarget const* target,
const std::string& lang,
const std::string& config);
2016-07-09 11:21:54 +02:00
void AddCMP0018Flags(std::string& flags, cmGeneratorTarget const* target,
2015-04-27 22:25:09 +02:00
std::string const& lang, const std::string& config);
2016-07-09 11:21:54 +02:00
void AddVisibilityPresetFlags(std::string& flags,
2016-03-13 13:35:51 +01:00
cmGeneratorTarget const* target,
2015-04-27 22:25:09 +02:00
const std::string& lang);
void AddConfigVariableFlags(std::string& flags, const std::string& var,
const std::string& config);
2016-07-09 11:21:54 +02:00
void AddCompilerRequirementFlag(std::string& flags,
2016-03-13 13:35:51 +01:00
cmGeneratorTarget const* target,
2015-04-27 22:25:09 +02:00
const std::string& lang);
2019-11-11 23:01:05 +01:00
//! Append flags to a string.
2018-04-23 21:13:27 +02:00
virtual void AppendFlags(std::string& flags,
const std::string& newFlags) const;
2020-02-01 23:06:01 +01:00
virtual void AppendFlags(std::string& flags,
const std::vector<BT<std::string>>& newFlags) const;
2015-04-27 22:25:09 +02:00
virtual void AppendFlagEscape(std::string& flags,
2018-04-23 21:13:27 +02:00
const std::string& rawFlag) const;
2020-02-01 23:06:01 +01:00
void AddPchDependencies(cmGeneratorTarget* target);
void AddUnityBuild(cmGeneratorTarget* target);
2017-07-20 19:35:53 +02:00
void AppendIPOLinkerFlags(std::string& flags, cmGeneratorTarget* target,
const std::string& config,
const std::string& lang);
2019-11-11 23:01:05 +01:00
void AppendPositionIndependentLinkerFlags(std::string& flags,
cmGeneratorTarget* target,
const std::string& config,
const std::string& lang);
//! Get the include flags for the current makefile and language
2016-07-09 11:21:54 +02:00
std::string GetIncludeFlags(const std::vector<std::string>& includes,
2013-11-03 12:27:13 +02:00
cmGeneratorTarget* target,
2015-04-27 22:25:09 +02:00
const std::string& lang,
bool forceFullPaths = false,
bool forResponseFile = false,
const std::string& config = "");
2020-08-30 11:54:41 +02:00
using GeneratorTargetVector =
std::vector<std::unique_ptr<cmGeneratorTarget>>;
const GeneratorTargetVector& GetGeneratorTargets() const
2016-07-09 11:21:54 +02:00
{
return this->GeneratorTargets;
}
2016-03-13 13:35:51 +01:00
2020-08-30 11:54:41 +02:00
void AddGeneratorTarget(std::unique_ptr<cmGeneratorTarget> gt);
2016-03-13 13:35:51 +01:00
void AddImportedGeneratorTarget(cmGeneratorTarget* gt);
2020-08-30 11:54:41 +02:00
void AddOwnedImportedGeneratorTarget(std::unique_ptr<cmGeneratorTarget> gt);
2016-03-13 13:35:51 +01:00
2016-07-09 11:21:54 +02:00
cmGeneratorTarget* FindLocalNonAliasGeneratorTarget(
const std::string& name) const;
2016-03-13 13:35:51 +01:00
cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const;
2018-04-23 21:13:27 +02:00
/**
* Process a list of include directories
*/
void AppendIncludeDirectories(std::vector<std::string>& includes,
std::string const& includes_list,
2020-08-30 11:54:41 +02:00
const cmSourceFile& sourceFile) const;
2018-04-23 21:13:27 +02:00
void AppendIncludeDirectories(std::vector<std::string>& includes,
const std::vector<std::string>& includes_vec,
const cmSourceFile& sourceFile) const;
/**
* Encode a list of preprocessor definitions for the compiler
* command line.
*/
2016-10-30 18:24:19 +01:00
void AppendDefines(std::set<std::string>& defines,
2019-11-11 23:01:05 +01:00
std::string const& defines_list) const;
void AppendDefines(std::set<BT<std::string>>& defines,
std::string const& defines_list) const;
void AppendDefines(std::set<BT<std::string>>& defines,
const std::vector<BT<std::string>>& defines_vec) const;
2013-11-03 12:27:13 +02:00
2018-04-23 21:13:27 +02:00
/**
* Encode a list of compile options for the compiler
* command line.
*/
void AppendCompileOptions(std::string& options,
std::string const& options_list,
2020-08-30 11:54:41 +02:00
const char* regex = nullptr) const;
2018-04-23 21:13:27 +02:00
void AppendCompileOptions(std::string& options,
const std::vector<std::string>& options_vec,
const char* regex = nullptr) const;
2020-02-01 23:06:01 +01:00
void AppendCompileOptions(std::vector<BT<std::string>>& options,
const std::vector<BT<std::string>>& options_vec,
const char* regex = nullptr) const;
2018-04-23 21:13:27 +02:00
2013-03-16 19:13:01 +02:00
/**
* Join a set of defines into a definesString with a space separator.
*/
void JoinDefines(const std::set<std::string>& defines,
2016-07-09 11:21:54 +02:00
std::string& definesString, const std::string& lang);
2009-10-11 10:55:36 +03:00
/** Lookup and append options associated with a particular feature. */
2015-04-27 22:25:09 +02:00
void AppendFeatureOptions(std::string& flags, const std::string& lang,
2009-10-11 10:55:36 +03:00
const char* feature);
2015-11-17 17:22:37 +01:00
const char* GetFeature(const std::string& feature,
const std::string& config);
2012-04-19 19:04:21 +03:00
/** \brief Get absolute path to dependency \a name
*
* Translate a dependency as given in CMake code to the name to
* appear in a generated build file.
* - If \a name is a utility target, returns false.
* - If \a name is a CMake target, it will be transformed to the real output
* location of that target for the given configuration.
* - If \a name is the full path to a file, it will be returned.
* - Otherwise \a name is treated as a relative path with respect to
* the source directory of this generator. This should only be
* used for dependencies of custom commands.
*/
2015-04-27 22:25:09 +02:00
bool GetRealDependency(const std::string& name, const std::string& config,
2011-01-16 11:35:12 +01:00
std::string& dep);
2016-07-09 11:21:54 +02:00
virtual std::string ConvertToIncludeReference(
std::string const& path,
cmOutputConverter::OutputFormat format = cmOutputConverter::SHELL,
bool forceFullPaths = false);
2012-02-18 12:40:36 +02:00
/** Called from command-line hook to clear dependencies. */
2016-07-09 11:21:54 +02:00
virtual void ClearDependencies(cmMakefile* /* mf */, bool /* verbose */) {}
2012-02-18 12:40:36 +02:00
/** Called from command-line hook to update dependencies. */
2019-11-11 23:01:05 +01:00
virtual bool UpdateDependencies(const std::string& /* tgtInfo */,
bool /*verbose*/, bool /*color*/)
2016-07-09 11:21:54 +02:00
{
return true;
}
2019-11-11 23:01:05 +01:00
/** @brief Get the include directories for the current makefile and language
* and optional the compiler implicit include directories.
*
2018-10-28 12:09:07 +01:00
* @arg stripImplicitDirs Strip all directories found in
* CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES from the result.
* @arg appendAllImplicitDirs Append all directories found in
* CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES to the result.
*/
2019-11-11 23:01:05 +01:00
std::vector<BT<std::string>> GetIncludeDirectoriesImplicit(
cmGeneratorTarget const* target, std::string const& lang = "C",
std::string const& config = "", bool stripImplicitDirs = true,
bool appendAllImplicitDirs = false) const;
/** @brief Get the include directories for the current makefile and language
* and optional the compiler implicit include directories.
*
* @arg dirs Directories are appended to this list
*/
void GetIncludeDirectoriesImplicit(std::vector<std::string>& dirs,
cmGeneratorTarget const* target,
const std::string& lang = "C",
const std::string& config = "",
bool stripImplicitDirs = true,
bool appendAllImplicitDirs = false) const;
/** @brief Get the include directories for the current makefile and language.
* @arg dirs Include directories are appended to this list
*/
void GetIncludeDirectories(std::vector<std::string>& dirs,
2016-03-13 13:35:51 +01:00
cmGeneratorTarget const* target,
2015-04-27 22:25:09 +02:00
const std::string& lang = "C",
2019-11-11 23:01:05 +01:00
const std::string& config = "") const;
/** @brief Get the include directories for the current makefile and language.
* @return The include directory list
*/
std::vector<BT<std::string>> GetIncludeDirectories(
cmGeneratorTarget const* target, std::string const& lang = "C",
std::string const& config = "") const;
2016-03-13 13:35:51 +01:00
void AddCompileOptions(std::string& flags, cmGeneratorTarget* target,
2015-04-27 22:25:09 +02:00
const std::string& lang, const std::string& config);
2020-02-01 23:06:01 +01:00
void AddCompileOptions(std::vector<BT<std::string>>& flags,
cmGeneratorTarget* target, const std::string& lang,
const std::string& config);
2020-08-30 11:54:41 +02:00
/**
* Add a custom PRE_BUILD, PRE_LINK, or POST_BUILD command to a target.
*/
cmTarget* AddCustomCommandToTarget(
const std::string& target, const std::vector<std::string>& byproducts,
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines, cmCustomCommandType type,
const char* comment, const char* workingDir, bool escapeOldStyle = true,
bool uses_terminal = false, const std::string& depfile = "",
const std::string& job_pool = "", bool command_expand_lists = false,
cmObjectLibraryCommands objLibCommands = cmObjectLibraryCommands::Reject,
bool stdPipesUTF8 = false);
/**
* Add a custom command to a source file.
*/
cmSourceFile* AddCustomCommandToOutput(
const std::string& output, const std::vector<std::string>& depends,
const std::string& main_dependency,
const cmCustomCommandLines& commandLines, const char* comment,
const char* workingDir, bool replace = false, bool escapeOldStyle = true,
bool uses_terminal = false, bool command_expand_lists = false,
const std::string& depfile = "", const std::string& job_pool = "",
bool stdPipesUTF8 = false);
cmSourceFile* AddCustomCommandToOutput(
const std::vector<std::string>& outputs,
const std::vector<std::string>& byproducts,
const std::vector<std::string>& depends,
const std::string& main_dependency,
const cmImplicitDependsList& implicit_depends,
const cmCustomCommandLines& commandLines, const char* comment,
const char* workingDir, bool replace = false, bool escapeOldStyle = true,
bool uses_terminal = false, bool command_expand_lists = false,
const std::string& depfile = "", const std::string& job_pool = "",
bool stdPipesUTF8 = false);
/**
* Add a utility to the build. A utility target is a command that is run
* every time the target is built.
*/
cmTarget* AddUtilityCommand(
const std::string& utilityName, bool excludeFromAll,
const char* workingDir, const std::vector<std::string>& byproducts,
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines, bool escapeOldStyle = true,
const char* comment = nullptr, bool uses_terminal = false,
bool command_expand_lists = false, const std::string& job_pool = "",
bool stdPipesUTF8 = false);
2016-03-13 13:35:51 +01:00
std::string GetProjectName() const;
/** Compute the language used to compile the given source file. */
2015-04-27 22:25:09 +02:00
std::string GetSourceFileLanguage(const cmSourceFile& source);
2012-06-27 20:52:58 +03:00
// Fill the vector with the target names for the object files,
// preprocessed files and assembly files.
2016-03-13 13:35:51 +01:00
void GetIndividualFileTargets(std::vector<std::string>&) {}
2012-06-27 20:52:58 +03:00
/**
* Get the relative path from the generator output directory to a
* per-target support directory.
*/
2016-07-09 11:21:54 +02:00
virtual std::string GetTargetDirectory(
cmGeneratorTarget const* target) const;
/**
* Get the level of backwards compatibility requested by the project
* in this directory. This is the value of the CMake variable
* CMAKE_BACKWARDS_COMPATIBILITY whose format is
* "major.minor[.patch]". The returned integer is encoded as
*
* CMake_VERSION_ENCODE(major, minor, patch)
*
* and is monotonically increasing with the CMake version.
*/
2016-03-13 13:35:51 +01:00
KWIML_INT_uint64_t GetBackwardsCompatibility();
/**
* Test whether compatibility is set to a given version or lower.
*/
2014-08-03 19:52:23 +02:00
bool NeedBackwardsCompatibility_2_4();
2016-03-13 13:35:51 +01:00
cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id) const;
cmake* GetCMakeInstance() const;
2018-04-23 21:13:27 +02:00
std::string const& GetSourceDirectory() const;
std::string const& GetBinaryDirectory() const;
2016-03-13 13:35:51 +01:00
2018-10-28 12:09:07 +01:00
std::string const& GetCurrentBinaryDirectory() const;
std::string const& GetCurrentSourceDirectory() const;
2016-03-13 13:35:51 +01:00
2019-11-11 23:01:05 +01:00
/**
* Convert the given remote path to a relative path with respect to
* the given local path. Both paths must use forward slashes and not
* already be escaped or quoted.
* The conversion is skipped if the paths are not both in the source
* or both in the binary tree.
*/
std::string MaybeConvertToRelativePath(std::string const& local_path,
std::string const& remote_path) const;
/**
2018-10-28 12:09:07 +01:00
* Generate a macOS application bundle Info.plist file.
*/
2016-03-13 13:35:51 +01:00
void GenerateAppleInfoPList(cmGeneratorTarget* target,
const std::string& targetName,
2019-11-11 23:01:05 +01:00
const std::string& fname);
/**
2018-10-28 12:09:07 +01:00
* Generate a macOS framework Info.plist file.
*/
2016-03-13 13:35:51 +01:00
void GenerateFrameworkInfoPList(cmGeneratorTarget* target,
2015-04-27 22:25:09 +02:00
const std::string& targetName,
2019-11-11 23:01:05 +01:00
const std::string& fname);
/** Construct a comment for a custom command. */
2015-04-27 22:25:09 +02:00
std::string ConstructComment(cmCustomCommandGenerator const& ccg,
const char* default_comment = "");
2009-10-04 10:30:41 +03:00
// Compute object file names.
2016-10-30 18:24:19 +01:00
std::string GetObjectFileNameWithoutTarget(
const cmSourceFile& source, std::string const& dir_max,
2018-01-26 17:06:56 +01:00
bool* hasSourceExtension = nullptr,
char const* customOutputExtension = nullptr);
2013-11-03 12:27:13 +02:00
/** Fill out the static linker flags for the given target. */
2016-07-09 11:21:54 +02:00
void GetStaticLibraryFlags(std::string& flags, std::string const& config,
2018-10-28 12:09:07 +01:00
std::string const& linkLanguage,
2016-03-13 13:35:51 +01:00
cmGeneratorTarget* target);
2020-02-01 23:06:01 +01:00
std::vector<BT<std::string>> GetStaticLibraryFlags(
std::string const& config, std::string const& linkLanguage,
cmGeneratorTarget* target);
2013-11-03 12:27:13 +02:00
/** Fill out these strings for the given target. Libraries to link,
* flags, and linkflags. */
2020-08-30 11:54:41 +02:00
void GetDeviceLinkFlags(cmLinkLineComputer* linkLineComputer,
const std::string& config, std::string& linkLibs,
std::string& linkFlags, std::string& frameworkPath,
std::string& linkPath, cmGeneratorTarget* target);
2017-04-14 19:02:05 +02:00
void GetTargetFlags(cmLinkLineComputer* linkLineComputer,
const std::string& config, std::string& linkLibs,
2016-10-30 18:24:19 +01:00
std::string& flags, std::string& linkFlags,
std::string& frameworkPath, std::string& linkPath,
2017-04-14 19:02:05 +02:00
cmGeneratorTarget* target);
2020-02-01 23:06:01 +01:00
void GetTargetFlags(
cmLinkLineComputer* linkLineComputer, const std::string& config,
std::vector<BT<std::string>>& linkLibs, std::string& flags,
std::vector<BT<std::string>>& linkFlags, std::string& frameworkPath,
std::vector<BT<std::string>>& linkPath, cmGeneratorTarget* target);
2016-10-30 18:24:19 +01:00
void GetTargetDefines(cmGeneratorTarget const* target,
std::string const& config, std::string const& lang,
std::set<std::string>& defines) const;
2019-11-11 23:01:05 +01:00
std::set<BT<std::string>> GetTargetDefines(cmGeneratorTarget const* target,
std::string const& config,
std::string const& lang) const;
2016-10-30 18:24:19 +01:00
void GetTargetCompileFlags(cmGeneratorTarget* target,
std::string const& config,
2020-08-30 11:54:41 +02:00
std::string const& lang, std::string& flags,
std::string const& arch = std::string());
std::vector<BT<std::string>> GetTargetCompileFlags(
cmGeneratorTarget* target, std::string const& config,
std::string const& lang, std::string const& arch = std::string());
2016-10-30 18:24:19 +01:00
std::string GetFrameworkFlags(std::string const& l,
std::string const& config,
cmGeneratorTarget* target);
virtual std::string GetTargetFortranFlags(cmGeneratorTarget const* target,
std::string const& config);
2015-04-27 22:25:09 +02:00
virtual void ComputeObjectFilenames(
2016-07-09 11:21:54 +02:00
std::map<cmSourceFile const*, std::string>& mapping,
2018-01-26 17:06:56 +01:00
cmGeneratorTarget const* gt = nullptr);
2012-02-18 12:40:36 +02:00
2015-08-17 11:37:30 +02:00
bool IsWindowsShell() const;
bool IsWatcomWMake() const;
bool IsMinGWMake() const;
bool IsNMake() const;
2020-08-30 11:54:41 +02:00
bool IsNinjaMulti() const;
2015-08-17 11:37:30 +02:00
2019-11-11 23:01:05 +01:00
void IssueMessage(MessageType t, std::string const& text) const;
2015-11-17 17:22:37 +01:00
2020-02-01 23:06:01 +01:00
void CreateEvaluationFileOutputs();
2015-11-17 17:22:37 +01:00
void CreateEvaluationFileOutputs(const std::string& config);
void ProcessEvaluationFiles(std::vector<std::string>& generatedFiles);
2015-08-17 11:37:30 +02:00
2016-03-13 13:35:51 +01:00
const char* GetRuleLauncher(cmGeneratorTarget* target,
const std::string& prop);
2017-04-14 19:02:05 +02:00
protected:
2019-11-11 23:01:05 +01:00
//! put all the libraries for a target on into the given stream
2017-04-14 19:02:05 +02:00
void OutputLinkLibraries(cmComputeLinkInformation* pcli,
cmLinkLineComputer* linkLineComputer,
std::string& linkLibraries,
std::string& frameworkPath, std::string& linkPath);
2020-02-01 23:06:01 +01:00
void OutputLinkLibraries(cmComputeLinkInformation* pcli,
cmLinkLineComputer* linkLineComputer,
std::vector<BT<std::string>>& linkLibraries,
std::string& frameworkPath,
std::vector<BT<std::string>>& linkPath);
2009-10-04 10:30:41 +03:00
// Handle old-style install rules stored in the targets.
void GenerateTargetInstallRules(
2015-04-27 22:25:09 +02:00
std::ostream& os, const std::string& config,
std::vector<std::string> const& configurationTypes);
2015-04-27 22:25:09 +02:00
std::string& CreateSafeUniqueObjectFileName(const std::string& sin,
std::string const& dir_max);
/** Check whether the native build system supports the given
definition. Issues a warning. */
virtual bool CheckDefinition(std::string const& define) const;
2016-07-09 11:21:54 +02:00
cmMakefile* Makefile;
2017-04-14 19:02:05 +02:00
cmStateSnapshot StateSnapshot;
2016-10-30 18:24:19 +01:00
cmListFileBacktrace DirectoryBacktrace;
2016-07-09 11:21:54 +02:00
cmGlobalGenerator* GlobalGenerator;
2015-04-27 22:25:09 +02:00
std::map<std::string, std::string> UniqueObjectNamesMap;
std::string::size_type ObjectPathMax;
2015-04-27 22:25:09 +02:00
std::set<std::string> ObjectMaxPathViolations;
2015-08-17 11:37:30 +02:00
2019-11-11 23:01:05 +01:00
std::set<std::string> EnvCPATH;
2020-02-01 23:06:01 +01:00
using GeneratorTargetMap =
std::unordered_map<std::string, cmGeneratorTarget*>;
2018-01-26 17:06:56 +01:00
GeneratorTargetMap GeneratorTargetSearchIndex;
2020-08-30 11:54:41 +02:00
GeneratorTargetVector GeneratorTargets;
2018-01-26 17:06:56 +01:00
std::set<cmGeneratorTarget const*> WarnCMP0063;
2018-04-23 21:13:27 +02:00
GeneratorTargetMap ImportedGeneratorTargets;
2020-08-30 11:54:41 +02:00
GeneratorTargetVector OwnedImportedGeneratorTargets;
2016-03-13 13:35:51 +01:00
std::map<std::string, std::string> AliasTargets;
2015-08-17 11:37:30 +02:00
2017-04-14 19:02:05 +02:00
std::map<std::string, std::string> Compilers;
std::map<std::string, std::string> VariableMappings;
std::string CompilerSysroot;
2017-07-20 19:35:53 +02:00
std::string LinkerSysroot;
2020-08-30 11:54:41 +02:00
std::unordered_map<std::string, std::string> AppleArchSysroots;
2015-08-17 11:37:30 +02:00
2017-04-14 19:02:05 +02:00
bool EmitUniversalBinaryFlags;
2016-03-13 13:35:51 +01:00
KWIML_INT_uint64_t BackwardsCompatibility;
bool BackwardsCompatibilityFinal;
2016-07-09 11:21:54 +02:00
private:
2015-04-27 22:25:09 +02:00
void AddSharedFlags(std::string& flags, const std::string& lang,
bool shared);
2016-07-09 11:21:54 +02:00
bool GetShouldUseOldFlags(bool shared, const std::string& lang) const;
2012-06-27 20:52:58 +03:00
void AddPositionIndependentFlags(std::string& flags, std::string const& l,
int targetType);
2015-11-17 17:22:37 +01:00
void ComputeObjectMaxPath();
2020-08-30 11:54:41 +02:00
bool AllAppleArchSysrootsAreTheSame(const std::vector<std::string>& archs,
const char* sysroot);
void CopyPchCompilePdb(const std::string& config, cmGeneratorTarget* target,
const std::string& ReuseFrom,
cmGeneratorTarget* reuseTarget,
std::vector<std::string> const& extensions);
};
2020-02-01 23:06:01 +01:00
#if !defined(CMAKE_BOOTSTRAP)
2016-07-09 11:21:54 +02:00
bool cmLocalGeneratorCheckObjectName(std::string& objName,
std::string::size_type dir_len,
std::string::size_type max_total_len);
#endif
2020-08-30 11:54:41 +02:00
namespace detail {
void AddCustomCommandToTarget(cmLocalGenerator& lg,
const cmListFileBacktrace& lfbt,
cmCommandOrigin origin, cmTarget* target,
const std::vector<std::string>& byproducts,
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines,
cmCustomCommandType type, const char* comment,
const char* workingDir, bool escapeOldStyle,
bool uses_terminal, const std::string& depfile,
const std::string& job_pool,
bool command_expand_lists, bool stdPipesUTF8);
cmSourceFile* AddCustomCommandToOutput(
cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
cmCommandOrigin origin, const std::vector<std::string>& outputs,
const std::vector<std::string>& byproducts,
const std::vector<std::string>& depends, const std::string& main_dependency,
const cmImplicitDependsList& implicit_depends,
const cmCustomCommandLines& commandLines, const char* comment,
const char* workingDir, bool replace, bool escapeOldStyle,
bool uses_terminal, bool command_expand_lists, const std::string& depfile,
const std::string& job_pool, bool stdPipesUTF8);
void AppendCustomCommandToOutput(cmLocalGenerator& lg,
const cmListFileBacktrace& lfbt,
const std::string& output,
const std::vector<std::string>& depends,
const cmImplicitDependsList& implicit_depends,
const cmCustomCommandLines& commandLines);
void AddUtilityCommand(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
cmCommandOrigin origin, cmTarget* target,
const cmUtilityOutput& force, const char* workingDir,
const std::vector<std::string>& byproducts,
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines,
bool escapeOldStyle, const char* comment,
bool uses_terminal, bool command_expand_lists,
const std::string& job_pool, bool stdPipesUTF8);
}
#endif