2016-09-27 15:01:08 -04:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2000-08-29 15:26:29 -04:00
|
|
|
#ifndef cmMakefile_h
|
|
|
|
#define cmMakefile_h
|
2001-01-11 14:47:38 -05:00
|
|
|
|
2017-08-25 20:39:02 +02:00
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
2016-04-29 09:40:20 -04:00
|
|
|
|
2019-09-06 22:58:06 +02:00
|
|
|
#include <cstddef>
|
2017-05-03 13:56:03 -04:00
|
|
|
#include <deque>
|
2016-12-28 23:15:41 +01:00
|
|
|
#include <functional>
|
2016-11-05 21:40:14 +01:00
|
|
|
#include <map>
|
2019-07-10 11:38:48 -04:00
|
|
|
#include <memory>
|
2016-11-05 21:40:14 +01:00
|
|
|
#include <set>
|
|
|
|
#include <stack>
|
|
|
|
#include <string>
|
2017-08-22 23:05:27 +02:00
|
|
|
#include <unordered_map>
|
2016-11-05 21:40:14 +01:00
|
|
|
#include <vector>
|
|
|
|
|
2019-08-04 10:49:16 +02:00
|
|
|
#include <cm/string_view>
|
2019-07-17 16:20:58 +02:00
|
|
|
|
2019-09-30 10:46:28 -04:00
|
|
|
#include "cmsys/RegularExpression.hxx"
|
|
|
|
|
2016-04-29 10:53:13 -04:00
|
|
|
#include "cmAlgorithms.h"
|
2019-09-20 22:44:14 +02:00
|
|
|
#include "cmCustomCommandTypes.h"
|
2002-12-11 18:13:33 -05:00
|
|
|
#include "cmListFileCache.h"
|
2018-11-22 03:36:50 +00:00
|
|
|
#include "cmMessageType.h"
|
2016-04-29 10:53:13 -04:00
|
|
|
#include "cmNewLineStyle.h"
|
2016-08-24 00:29:15 +02:00
|
|
|
#include "cmPolicies.h"
|
2018-01-09 08:40:48 -05:00
|
|
|
#include "cmSourceFileLocationKind.h"
|
2016-10-18 21:28:49 +02:00
|
|
|
#include "cmStateSnapshot.h"
|
2016-11-05 21:40:14 +01:00
|
|
|
#include "cmStateTypes.h"
|
2019-07-29 12:16:40 +02:00
|
|
|
#include "cmStringAlgorithms.h"
|
2019-09-20 22:44:14 +02:00
|
|
|
|
|
|
|
// IWYU does not see that 'std::unordered_map<std::string, cmTarget>'
|
|
|
|
// will not compile without the complete type.
|
|
|
|
#include "cmTarget.h" // IWYU pragma: keep
|
2001-08-08 11:54:46 -04:00
|
|
|
|
2019-08-09 10:41:44 -04:00
|
|
|
#if !defined(CMAKE_BOOTSTRAP)
|
2018-06-01 09:53:41 -04:00
|
|
|
# include "cmSourceGroup.h"
|
2006-03-22 09:58:11 -05:00
|
|
|
#endif
|
|
|
|
|
2016-08-24 00:29:15 +02:00
|
|
|
class cmCompiledGeneratorExpression;
|
|
|
|
class cmCustomCommandLines;
|
|
|
|
class cmExecutionStatus;
|
|
|
|
class cmExpandedCommandArgument;
|
|
|
|
class cmExportBuildFileGenerator;
|
2019-07-26 23:45:50 +02:00
|
|
|
class cmFunctionBlocker;
|
2016-08-24 00:29:15 +02:00
|
|
|
class cmGeneratorExpressionEvaluationFile;
|
|
|
|
class cmGlobalGenerator;
|
2019-09-12 23:00:36 +02:00
|
|
|
class cmImplicitDependsList;
|
2006-02-19 15:25:27 -05:00
|
|
|
class cmInstallGenerator;
|
2019-10-17 15:40:09 +02:00
|
|
|
class cmLocalGenerator;
|
2016-09-01 20:59:28 +02:00
|
|
|
class cmMessenger;
|
2002-12-02 15:59:59 -05:00
|
|
|
class cmSourceFile;
|
2016-11-05 21:40:14 +01:00
|
|
|
class cmState;
|
2005-04-24 15:59:51 -04:00
|
|
|
class cmTest;
|
2009-03-16 10:40:46 -04:00
|
|
|
class cmTestGenerator;
|
2003-01-08 12:59:52 -05:00
|
|
|
class cmVariableWatch;
|
2018-11-22 03:36:50 +00:00
|
|
|
class cmake;
|
2001-01-05 11:41:20 -05:00
|
|
|
|
2019-09-11 12:19:43 +02:00
|
|
|
/** Flag if byproducts shall also be considered. */
|
|
|
|
enum class cmSourceOutputKind
|
|
|
|
{
|
|
|
|
OutputOnly,
|
|
|
|
OutputOrByproduct
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Target and source file which have a specific output. */
|
|
|
|
struct cmSourcesWithOutput
|
|
|
|
{
|
|
|
|
/** Target with byproduct. */
|
|
|
|
cmTarget* Target = nullptr;
|
|
|
|
|
|
|
|
/** Source file with output or byproduct. */
|
|
|
|
cmSourceFile* Source = nullptr;
|
|
|
|
bool SourceIsByproduct = false;
|
|
|
|
};
|
|
|
|
|
2018-09-07 12:59:52 -04:00
|
|
|
/** A type-safe wrapper for a string representing a directory id. */
|
|
|
|
class cmDirectoryId
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmDirectoryId(std::string s);
|
|
|
|
std::string String;
|
|
|
|
};
|
|
|
|
|
2001-01-11 14:47:38 -05:00
|
|
|
/** \class cmMakefile
|
|
|
|
* \brief Process the input CMakeLists.txt file.
|
|
|
|
*
|
|
|
|
* Process and store into memory the input CMakeLists.txt file.
|
2001-01-18 11:20:24 -05:00
|
|
|
* Each CMakeLists.txt file is parsed and the commands found there
|
2001-01-11 14:47:38 -05:00
|
|
|
* are added into the build process.
|
|
|
|
*/
|
2000-08-29 15:26:29 -04:00
|
|
|
class cmMakefile
|
|
|
|
{
|
|
|
|
public:
|
2010-09-15 11:34:35 -04:00
|
|
|
/* Mark a variable as used */
|
2014-02-04 16:06:56 -05:00
|
|
|
void MarkVariableAsUsed(const std::string& var);
|
2010-08-24 14:38:06 -04:00
|
|
|
/* return true if a variable has been initialized */
|
2016-05-16 10:34:04 -04:00
|
|
|
bool VariableInitialized(const std::string&) const;
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2001-01-11 14:47:38 -05:00
|
|
|
/**
|
|
|
|
* Construct an empty makefile.
|
|
|
|
*/
|
2015-08-02 11:20:28 +02:00
|
|
|
cmMakefile(cmGlobalGenerator* globalGenerator,
|
2016-10-18 21:28:48 +02:00
|
|
|
const cmStateSnapshot& snapshot);
|
2001-01-11 14:47:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Destructor.
|
|
|
|
*/
|
2002-08-23 16:13:34 -04:00
|
|
|
~cmMakefile();
|
2001-01-11 14:47:38 -05:00
|
|
|
|
2019-01-23 20:30:01 +01:00
|
|
|
cmMakefile(cmMakefile const&) = delete;
|
|
|
|
cmMakefile& operator=(cmMakefile const&) = delete;
|
|
|
|
|
2018-09-07 12:59:52 -04:00
|
|
|
cmDirectoryId GetDirectoryId() const;
|
|
|
|
|
2019-01-17 12:36:07 -05:00
|
|
|
bool ReadListFile(const std::string& filename);
|
2015-04-18 14:50:31 +02:00
|
|
|
|
2019-01-17 12:36:07 -05:00
|
|
|
bool ReadDependentFile(const std::string& filename,
|
|
|
|
bool noPolicyScope = true);
|
2001-01-11 14:47:38 -05:00
|
|
|
|
2001-04-19 17:39:03 -04:00
|
|
|
/**
|
|
|
|
* Add a function blocker to this makefile
|
|
|
|
*/
|
2019-07-12 12:15:21 +02:00
|
|
|
void AddFunctionBlocker(std::unique_ptr<cmFunctionBlocker> fb);
|
2009-01-20 14:36:18 -05:00
|
|
|
|
2015-06-06 14:07:15 +02:00
|
|
|
/// @return whether we are processing the top CMakeLists.txt file.
|
|
|
|
bool IsRootMakefile() const;
|
|
|
|
|
2009-01-20 14:36:18 -05:00
|
|
|
/**
|
|
|
|
* Remove the function blocker whose scope ends with the given command.
|
|
|
|
* This returns ownership of the function blocker object.
|
|
|
|
*/
|
2019-07-30 22:58:40 +02:00
|
|
|
std::unique_ptr<cmFunctionBlocker> RemoveFunctionBlocker();
|
2004-04-18 14:41:46 -04:00
|
|
|
|
2002-08-28 14:51:10 -04:00
|
|
|
/**
|
|
|
|
* Try running cmake and building a file. This is used for dynalically
|
|
|
|
* loaded commands, not as part of the usual build process.
|
|
|
|
*/
|
2014-02-24 17:38:30 -05:00
|
|
|
int TryCompile(const std::string& srcdir, const std::string& bindir,
|
2014-02-07 15:40:05 -05:00
|
|
|
const std::string& projectName, const std::string& targetName,
|
2018-04-14 22:50:19 +02:00
|
|
|
bool fast, int jobs,
|
|
|
|
const std::vector<std::string>* cmakeArgs,
|
2014-07-31 12:48:46 -04:00
|
|
|
std::string& output);
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2012-09-05 01:44:11 +02:00
|
|
|
bool GetIsSourceFileTryCompile() const;
|
|
|
|
|
2008-02-11 13:35:39 -05:00
|
|
|
/**
|
|
|
|
* Help enforce global target name uniqueness.
|
|
|
|
*/
|
2008-02-14 16:42:29 -05:00
|
|
|
bool EnforceUniqueName(std::string const& name, std::string& msg,
|
2014-01-22 15:00:29 +01:00
|
|
|
bool isCustom = false) const;
|
2008-02-11 13:35:39 -05:00
|
|
|
|
2019-10-17 15:40:09 +02:00
|
|
|
using GeneratorAction =
|
|
|
|
std::function<void(cmLocalGenerator&, const cmListFileBacktrace&)>;
|
2016-12-28 23:15:41 +01:00
|
|
|
|
|
|
|
/**
|
2019-10-17 15:40:09 +02:00
|
|
|
* Register an action that is executed during Generate
|
2016-12-28 23:15:41 +01:00
|
|
|
*/
|
2019-10-17 15:40:09 +02:00
|
|
|
void AddGeneratorAction(GeneratorAction action);
|
2016-12-28 23:15:41 +01:00
|
|
|
|
2001-01-11 14:47:38 -05:00
|
|
|
/**
|
2019-10-17 15:40:09 +02:00
|
|
|
* Perform generate actions, Library dependency analysis etc before output of
|
|
|
|
* the makefile.
|
2001-01-11 14:47:38 -05:00
|
|
|
*/
|
2019-10-17 15:40:09 +02:00
|
|
|
void Generate(cmLocalGenerator& lg);
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2019-09-21 00:55:34 +02:00
|
|
|
/**
|
|
|
|
* Get the target for PRE_BUILD, PRE_LINK, or POST_BUILD commands.
|
|
|
|
*/
|
2019-10-17 15:50:34 +02:00
|
|
|
cmTarget* GetCustomCommandTarget(const std::string& target,
|
|
|
|
cmObjectLibraryCommands objLibCommands,
|
|
|
|
const cmListFileBacktrace& lfbt) const;
|
2019-09-21 00:55:34 +02:00
|
|
|
|
2019-10-17 17:02:20 +02:00
|
|
|
/**
|
|
|
|
* Dispatch adding a custom PRE_BUILD, PRE_LINK, or POST_BUILD command to a
|
|
|
|
* target.
|
|
|
|
*/
|
2019-09-14 15:29:59 +02:00
|
|
|
cmTarget* AddCustomCommandToTarget(
|
2016-08-05 14:39:31 +02:00
|
|
|
const std::string& target, const std::vector<std::string>& byproducts,
|
|
|
|
const std::vector<std::string>& depends,
|
2019-09-20 22:44:14 +02:00
|
|
|
const cmCustomCommandLines& commandLines, cmCustomCommandType type,
|
2016-08-05 14:39:31 +02:00
|
|
|
const char* comment, const char* workingDir, bool escapeOldStyle = true,
|
2017-01-13 20:01:17 -06:00
|
|
|
bool uses_terminal = false, const std::string& depfile = "",
|
2019-10-17 17:02:20 +02:00
|
|
|
const std::string& job_pool = "", bool command_expand_lists = false);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called for each file with custom command.
|
|
|
|
*/
|
|
|
|
using CommandSourceCallback = std::function<void(cmSourceFile*)>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatch adding a custom command to a source file.
|
|
|
|
*/
|
|
|
|
void AddCustomCommandToOutput(
|
2019-09-14 22:59:05 +02:00
|
|
|
const std::string& output, const std::vector<std::string>& depends,
|
2014-02-24 20:32:55 -05:00
|
|
|
const std::string& main_dependency,
|
2016-05-16 10:34:04 -04:00
|
|
|
const cmCustomCommandLines& commandLines, const char* comment,
|
2019-10-17 17:02:20 +02:00
|
|
|
const char* workingDir, const CommandSourceCallback& callback = nullptr,
|
|
|
|
bool replace = false, bool escapeOldStyle = true,
|
2017-01-13 20:01:17 -06:00
|
|
|
bool uses_terminal = false, bool command_expand_lists = false,
|
2019-05-10 14:37:39 +02:00
|
|
|
const std::string& depfile = "", const std::string& job_pool = "");
|
2019-10-17 17:02:20 +02:00
|
|
|
void AddCustomCommandToOutput(
|
2019-09-14 22:59:05 +02:00
|
|
|
const std::vector<std::string>& outputs,
|
|
|
|
const std::vector<std::string>& byproducts,
|
|
|
|
const std::vector<std::string>& depends,
|
2014-02-24 20:32:55 -05:00
|
|
|
const std::string& main_dependency,
|
2019-09-14 22:59:05 +02:00
|
|
|
const cmImplicitDependsList& implicit_depends,
|
2016-05-16 10:34:04 -04:00
|
|
|
const cmCustomCommandLines& commandLines, const char* comment,
|
2019-10-17 17:02:20 +02:00
|
|
|
const char* workingDir, const CommandSourceCallback& callback = nullptr,
|
|
|
|
bool replace = false, bool escapeOldStyle = true,
|
2017-01-13 20:01:17 -06:00
|
|
|
bool uses_terminal = false, bool command_expand_lists = false,
|
2019-05-10 14:37:39 +02:00
|
|
|
const std::string& depfile = "", const std::string& job_pool = "");
|
2014-02-06 17:31:47 -05:00
|
|
|
void AddCustomCommandOldStyle(const std::string& target,
|
2005-02-22 10:32:44 -05:00
|
|
|
const std::vector<std::string>& outputs,
|
|
|
|
const std::vector<std::string>& depends,
|
2014-02-24 20:32:55 -05:00
|
|
|
const std::string& source,
|
2005-02-22 10:32:44 -05:00
|
|
|
const cmCustomCommandLines& commandLines,
|
|
|
|
const char* comment);
|
2019-09-12 23:20:13 +02:00
|
|
|
bool AppendCustomCommandToOutput(
|
|
|
|
const std::string& output, const std::vector<std::string>& depends,
|
|
|
|
const cmImplicitDependsList& implicit_depends,
|
|
|
|
const cmCustomCommandLines& commandLines);
|
2005-02-22 10:32:44 -05:00
|
|
|
|
2019-09-21 00:55:34 +02:00
|
|
|
/**
|
|
|
|
* Add target byproducts.
|
|
|
|
*/
|
|
|
|
void AddTargetByproducts(cmTarget* target,
|
|
|
|
const std::vector<std::string>& byproducts);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add source file outputs.
|
|
|
|
*/
|
|
|
|
void AddSourceOutputs(cmSourceFile* source,
|
|
|
|
const std::vector<std::string>& outputs,
|
|
|
|
const std::vector<std::string>& byproducts);
|
|
|
|
|
2001-01-11 14:47:38 -05:00
|
|
|
/**
|
|
|
|
* Add a define flag to the build.
|
|
|
|
*/
|
2018-01-31 18:20:02 +03:00
|
|
|
void AddDefineFlag(std::string const& definition);
|
|
|
|
void RemoveDefineFlag(std::string const& definition);
|
2018-04-19 14:58:49 +02:00
|
|
|
void AddCompileDefinition(std::string const& definition);
|
2018-01-31 18:20:02 +03:00
|
|
|
void AddCompileOption(std::string const& option);
|
2018-04-24 17:01:01 +02:00
|
|
|
void AddLinkOption(std::string const& option);
|
2018-09-19 14:12:35 +02:00
|
|
|
void AddLinkDirectory(std::string const& directory, bool before = false);
|
2001-01-11 14:47:38 -05:00
|
|
|
|
2008-01-28 08:38:36 -05:00
|
|
|
/** Create a new imported target with the name and type given. */
|
2014-02-06 17:31:47 -05:00
|
|
|
cmTarget* AddImportedTarget(const std::string& name,
|
2016-10-18 21:28:46 +02:00
|
|
|
cmStateEnums::TargetType type, bool global);
|
2008-01-28 08:38:36 -05:00
|
|
|
|
2016-10-18 21:28:46 +02:00
|
|
|
cmTarget* AddNewTarget(cmStateEnums::TargetType type,
|
|
|
|
const std::string& name);
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2019-09-21 00:55:34 +02:00
|
|
|
/** Create a target instance for the utility. */
|
|
|
|
cmTarget* AddNewUtilityTarget(const std::string& utilityName,
|
2019-10-17 17:02:20 +02:00
|
|
|
bool excludeFromAll);
|
2019-09-21 00:55:34 +02:00
|
|
|
|
2001-01-11 14:47:38 -05:00
|
|
|
/**
|
|
|
|
* Add an executable to the build.
|
|
|
|
*/
|
2018-01-22 20:47:53 -05:00
|
|
|
cmTarget* AddExecutable(const std::string& exename,
|
2016-05-16 10:34:04 -04:00
|
|
|
const std::vector<std::string>& srcs,
|
2007-03-12 10:26:59 -04:00
|
|
|
bool excludeFromAll = false);
|
2001-01-11 14:47:38 -05:00
|
|
|
|
2019-09-21 00:55:34 +02:00
|
|
|
/**
|
|
|
|
* Return the utility target output source file name and the CMP0049 name.
|
|
|
|
*/
|
|
|
|
cmUtilityOutput GetUtilityOutput(cmTarget* target);
|
|
|
|
|
2001-05-01 16:55:32 -04:00
|
|
|
/**
|
2019-10-17 17:02:20 +02:00
|
|
|
* Dispatch adding a utility to the build. A utility target is a command
|
|
|
|
* that is run every time the target is built.
|
2001-05-01 16:55:32 -04:00
|
|
|
*/
|
2016-05-16 10:34:04 -04:00
|
|
|
cmTarget* AddUtilityCommand(
|
2019-10-17 17:02:20 +02:00
|
|
|
const std::string& utilityName, bool excludeFromAll,
|
|
|
|
const char* workingDir, const std::vector<std::string>& byproducts,
|
2016-05-16 10:34:04 -04:00
|
|
|
const std::vector<std::string>& depends,
|
|
|
|
const cmCustomCommandLines& commandLines, bool escapeOldStyle = true,
|
2017-08-22 23:42:36 +02:00
|
|
|
const char* comment = nullptr, bool uses_terminal = false,
|
2019-05-10 14:37:39 +02:00
|
|
|
bool command_expand_lists = false, const std::string& job_pool = "");
|
2001-05-01 16:55:32 -04:00
|
|
|
|
2001-01-11 14:47:38 -05:00
|
|
|
/**
|
|
|
|
* Add a subdirectory to the build.
|
|
|
|
*/
|
2014-02-07 15:33:35 -05:00
|
|
|
void AddSubDirectory(const std::string& fullSrcDir,
|
2016-05-16 10:34:04 -04:00
|
|
|
const std::string& fullBinDir, bool excludeFromAll,
|
2005-03-18 10:41:41 -05:00
|
|
|
bool immediate);
|
2001-01-11 14:47:38 -05:00
|
|
|
|
2015-05-30 19:50:58 +02:00
|
|
|
void Configure();
|
|
|
|
|
2005-03-18 10:41:41 -05:00
|
|
|
/**
|
|
|
|
* Configure a subdirectory
|
|
|
|
*/
|
2015-05-30 19:53:02 +02:00
|
|
|
void ConfigureSubDirectory(cmMakefile* mf);
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2001-01-11 14:47:38 -05:00
|
|
|
/**
|
|
|
|
* Add an include directory to the build.
|
|
|
|
*/
|
2016-05-16 10:34:04 -04:00
|
|
|
void AddIncludeDirectories(const std::vector<std::string>& incs,
|
2013-01-20 12:28:59 +01:00
|
|
|
bool before = false);
|
2001-01-11 14:47:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a variable definition to the build. This variable
|
|
|
|
* can be used in CMake to refer to lists, directories, etc.
|
|
|
|
*/
|
2019-07-17 16:20:58 +02:00
|
|
|
void AddDefinition(const std::string& name, cm::string_view value);
|
2019-07-19 11:08:38 +02:00
|
|
|
/**
|
|
|
|
* Add bool variable definition to the build.
|
|
|
|
*/
|
2019-07-17 16:20:58 +02:00
|
|
|
void AddDefinitionBool(const std::string& name, bool);
|
2019-03-31 11:27:12 +02:00
|
|
|
//! Add a definition to this makefile and the global cmake cache.
|
2014-02-04 16:06:56 -05:00
|
|
|
void AddCacheDefinition(const std::string& name, const char* value,
|
2016-10-18 21:28:47 +02:00
|
|
|
const char* doc, cmStateEnums::CacheEntryType type,
|
2008-11-21 16:32:39 -05:00
|
|
|
bool force = false);
|
2001-01-11 14:47:38 -05:00
|
|
|
|
2002-09-18 10:39:41 -04:00
|
|
|
/**
|
|
|
|
* Remove a variable definition from the build. This is not valid
|
|
|
|
* for cache entries, and will only affect the current makefile.
|
|
|
|
*/
|
2014-02-04 16:06:56 -05:00
|
|
|
void RemoveDefinition(const std::string& name);
|
2019-03-31 11:27:12 +02:00
|
|
|
//! Remove a definition from the cache.
|
2014-02-04 16:06:56 -05:00
|
|
|
void RemoveCacheDefinition(const std::string& name);
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2001-01-11 14:47:38 -05:00
|
|
|
/**
|
|
|
|
* Specify the name of the project for this build.
|
|
|
|
*/
|
2015-08-02 10:57:31 +02:00
|
|
|
void SetProjectName(std::string const& name);
|
2001-01-11 14:47:38 -05:00
|
|
|
|
2010-09-08 14:54:49 -04:00
|
|
|
/** Get the configurations to be generated. */
|
2014-02-09 22:48:34 -05:00
|
|
|
std::string GetConfigurations(std::vector<std::string>& configs,
|
2010-09-08 14:54:49 -04:00
|
|
|
bool single = true) const;
|
|
|
|
|
2019-08-30 11:47:37 +02:00
|
|
|
/** Get the configurations for dependency checking. */
|
|
|
|
std::vector<std::string> GetGeneratorConfigs() const;
|
|
|
|
|
2001-01-11 14:47:38 -05:00
|
|
|
/**
|
|
|
|
* Set the name of the library.
|
|
|
|
*/
|
2016-10-18 21:28:46 +02:00
|
|
|
cmTarget* AddLibrary(const std::string& libname,
|
|
|
|
cmStateEnums::TargetType type,
|
2016-05-16 10:34:04 -04:00
|
|
|
const std::vector<std::string>& srcs,
|
|
|
|
bool excludeFromAll = false);
|
2015-10-25 12:43:00 +01:00
|
|
|
void AddAlias(const std::string& libname, const std::string& tgt);
|
2001-01-11 14:47:38 -05:00
|
|
|
|
2008-03-01 15:20:35 -05:00
|
|
|
//@{
|
|
|
|
/**
|
2018-06-01 09:53:41 -04:00
|
|
|
* Set, Push, Pop policy values for CMake.
|
|
|
|
*/
|
2008-03-01 15:20:35 -05:00
|
|
|
bool SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status);
|
2016-05-16 10:34:04 -04:00
|
|
|
bool SetPolicy(const char* id, cmPolicies::PolicyStatus status);
|
2018-04-17 11:43:56 -04:00
|
|
|
cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id,
|
|
|
|
bool parent_scope = false) const;
|
2018-03-16 12:42:36 -04:00
|
|
|
bool SetPolicyVersion(std::string const& version_min,
|
|
|
|
std::string const& version_max);
|
2009-01-22 13:16:47 -05:00
|
|
|
void RecordPolicies(cmPolicies::PolicyMap& pm);
|
2008-03-01 15:20:35 -05:00
|
|
|
//@}
|
|
|
|
|
2009-01-22 10:56:50 -05:00
|
|
|
/** Helper class to push and pop policies automatically. */
|
|
|
|
class PolicyPushPop
|
|
|
|
{
|
|
|
|
public:
|
2015-11-24 13:06:42 -05:00
|
|
|
PolicyPushPop(cmMakefile* m);
|
2009-01-22 10:56:50 -05:00
|
|
|
~PolicyPushPop();
|
2016-05-16 10:34:04 -04:00
|
|
|
|
2019-02-14 17:29:57 +01:00
|
|
|
PolicyPushPop(const PolicyPushPop&) = delete;
|
|
|
|
PolicyPushPop& operator=(const PolicyPushPop&) = delete;
|
|
|
|
|
2009-01-22 10:56:50 -05:00
|
|
|
private:
|
|
|
|
cmMakefile* Makefile;
|
|
|
|
};
|
|
|
|
friend class PolicyPushPop;
|
|
|
|
|
2014-09-04 20:21:28 +02:00
|
|
|
/**
|
|
|
|
* Determine if the given context, name pair has already been reported
|
|
|
|
* in context of CMP0054.
|
|
|
|
*/
|
2016-05-16 10:34:04 -04:00
|
|
|
bool HasCMP0054AlreadyBeenReported(const cmListFileContext& context) const;
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2015-05-08 15:41:08 -04:00
|
|
|
bool IgnoreErrorsCMP0061() const;
|
|
|
|
|
2018-01-31 18:20:02 +03:00
|
|
|
std::string const& GetHomeDirectory() const;
|
|
|
|
std::string const& GetHomeOutputDirectory() const;
|
2011-02-02 18:18:14 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set CMAKE_SCRIPT_MODE_FILE variable when running a -P script.
|
|
|
|
*/
|
2018-01-31 18:20:02 +03:00
|
|
|
void SetScriptModeFile(std::string const& scriptfile);
|
2011-02-02 18:18:14 -05:00
|
|
|
|
2011-02-02 21:17:23 -05:00
|
|
|
/**
|
|
|
|
* Set CMAKE_ARGC, CMAKE_ARGV0 ... variables.
|
|
|
|
*/
|
|
|
|
void SetArgcArgv(const std::vector<std::string>& args);
|
|
|
|
|
2018-08-24 13:58:19 -04:00
|
|
|
std::string const& GetCurrentSourceDirectory() const;
|
|
|
|
std::string const& GetCurrentBinaryDirectory() const;
|
2001-04-30 10:52:58 -04:00
|
|
|
|
2001-02-15 13:30:13 -05:00
|
|
|
//@}
|
2001-03-15 18:09:16 -05:00
|
|
|
|
2011-10-13 19:51:18 +02:00
|
|
|
/**
|
2001-03-15 18:09:16 -05:00
|
|
|
* Set a regular expression that include files must match
|
|
|
|
* in order to be considered as part of the depend information.
|
|
|
|
*/
|
|
|
|
void SetIncludeRegularExpression(const char* regex)
|
2016-05-16 10:34:04 -04:00
|
|
|
{
|
|
|
|
this->SetProperty("INCLUDE_REGULAR_EXPRESSION", regex);
|
|
|
|
}
|
2014-01-22 14:38:10 +01:00
|
|
|
const char* GetIncludeRegularExpression() const
|
2016-05-16 10:34:04 -04:00
|
|
|
{
|
|
|
|
return this->GetProperty("INCLUDE_REGULAR_EXPRESSION");
|
|
|
|
}
|
2001-03-15 18:09:16 -05:00
|
|
|
|
2011-10-13 19:51:18 +02:00
|
|
|
/**
|
2001-06-21 15:02:52 -04:00
|
|
|
* Set a regular expression that include files that are not found
|
|
|
|
* must match in order to be considered a problem.
|
|
|
|
*/
|
2014-02-03 21:06:17 -05:00
|
|
|
void SetComplainRegularExpression(const std::string& regex)
|
2016-05-16 10:34:04 -04:00
|
|
|
{
|
|
|
|
this->ComplainFileRegularExpression = regex;
|
|
|
|
}
|
2014-01-22 15:00:29 +01:00
|
|
|
const char* GetComplainRegularExpression() const
|
2016-05-16 10:34:04 -04:00
|
|
|
{
|
|
|
|
return this->ComplainFileRegularExpression.c_str();
|
|
|
|
}
|
2001-06-21 15:02:52 -04:00
|
|
|
|
2019-05-23 12:52:36 +02:00
|
|
|
// -- List of targets
|
2019-08-23 23:25:56 +02:00
|
|
|
using cmTargetMap = std::unordered_map<std::string, cmTarget>;
|
2019-05-23 12:52:36 +02:00
|
|
|
/** Get the target map */
|
|
|
|
cmTargetMap& GetTargets() { return this->Targets; }
|
|
|
|
/** Get the target map - const version */
|
|
|
|
cmTargetMap const& GetTargets() const { return this->Targets; }
|
|
|
|
|
2020-01-12 16:58:54 +01:00
|
|
|
const std::vector<std::unique_ptr<cmTarget>>& GetOwnedImportedTargets() const
|
2016-05-16 10:34:04 -04:00
|
|
|
{
|
|
|
|
return this->ImportedTargetsOwned;
|
|
|
|
}
|
2015-10-26 22:18:20 +01:00
|
|
|
std::vector<cmTarget*> GetImportedTargets() const;
|
2001-01-11 14:47:38 -05:00
|
|
|
|
2016-04-01 10:26:08 -04:00
|
|
|
cmTarget* FindLocalNonAliasTarget(const std::string& name) const;
|
2001-01-11 14:47:38 -05:00
|
|
|
|
2008-01-28 08:38:36 -05:00
|
|
|
/** Find a target to use in place of the given name. The target
|
|
|
|
returned may be imported or built within the project. */
|
2014-01-15 23:56:38 +01:00
|
|
|
cmTarget* FindTargetToUse(const std::string& name,
|
2014-01-22 15:00:29 +01:00
|
|
|
bool excludeAliases = false) const;
|
|
|
|
bool IsAlias(const std::string& name) const;
|
2006-04-11 12:51:20 -04:00
|
|
|
|
2015-10-25 12:52:46 +01:00
|
|
|
std::map<std::string, std::string> GetAliasTargets() const
|
|
|
|
{
|
|
|
|
return this->AliasTargets;
|
|
|
|
}
|
|
|
|
|
2006-10-05 08:55:59 -04:00
|
|
|
/**
|
|
|
|
* Mark include directories as system directories.
|
|
|
|
*/
|
2016-05-16 10:34:04 -04:00
|
|
|
void AddSystemIncludeDirectories(const std::set<std::string>& incs);
|
2006-10-05 08:55:59 -04:00
|
|
|
|
2002-03-29 10:06:30 -05:00
|
|
|
/** Get a cmSourceFile pointer for a given source name, if the name is
|
|
|
|
* not found, then a null pointer is returned.
|
|
|
|
*/
|
2018-01-09 08:40:48 -05:00
|
|
|
cmSourceFile* GetSource(
|
|
|
|
const std::string& sourceName,
|
|
|
|
cmSourceFileLocationKind kind = cmSourceFileLocationKind::Ambiguous) const;
|
2003-06-03 10:30:23 -04:00
|
|
|
|
2014-03-11 18:04:11 -04:00
|
|
|
/** Create the source file and return it. generated
|
|
|
|
* indicates if it is a generated file, this is used in determining
|
|
|
|
* how to create the source file instance e.g. name
|
|
|
|
*/
|
2018-01-09 08:40:48 -05:00
|
|
|
cmSourceFile* CreateSource(
|
|
|
|
const std::string& sourceName, bool generated = false,
|
|
|
|
cmSourceFileLocationKind kind = cmSourceFileLocationKind::Ambiguous);
|
2014-03-11 18:04:11 -04:00
|
|
|
|
2003-06-03 10:30:23 -04:00
|
|
|
/** Get a cmSourceFile pointer for a given source name, if the name is
|
2011-10-13 19:51:18 +02:00
|
|
|
* not found, then create the source file and return it. generated
|
2003-06-03 10:30:23 -04:00
|
|
|
* indicates if it is a generated file, this is used in determining
|
|
|
|
* how to create the source file instance e.g. name
|
|
|
|
*/
|
2018-01-09 08:40:48 -05:00
|
|
|
cmSourceFile* GetOrCreateSource(
|
|
|
|
const std::string& sourceName, bool generated = false,
|
|
|
|
cmSourceFileLocationKind kind = cmSourceFileLocationKind::Ambiguous);
|
2007-06-18 11:59:23 -04:00
|
|
|
|
2019-09-21 00:55:34 +02:00
|
|
|
/** Get a cmSourceFile pointer for a given source name and always mark the
|
|
|
|
* file as generated, if the name is not found, then create the source file
|
|
|
|
* and return it.
|
|
|
|
*/
|
|
|
|
cmSourceFile* GetOrCreateGeneratedSource(const std::string& sourceName);
|
|
|
|
|
2017-04-10 14:48:57 -04:00
|
|
|
void AddTargetObject(std::string const& tgtName, std::string const& objFile);
|
|
|
|
|
2001-01-11 14:47:38 -05:00
|
|
|
/**
|
|
|
|
* Given a variable name, return its value (as a string).
|
2001-08-08 11:54:46 -04:00
|
|
|
* If the variable is not found in this makefile instance, the
|
|
|
|
* cache is then queried.
|
2001-01-05 11:41:20 -05:00
|
|
|
*/
|
2014-02-04 16:06:56 -05:00
|
|
|
const char* GetDefinition(const std::string&) const;
|
2018-09-05 06:41:28 -04:00
|
|
|
const std::string* GetDef(const std::string&) const;
|
|
|
|
const std::string& GetSafeDefinition(const std::string&) const;
|
2019-02-06 17:44:53 -05:00
|
|
|
const std::string& GetRequiredDefinition(const std::string& name) const;
|
2014-02-04 16:06:56 -05:00
|
|
|
bool IsDefinitionSet(const std::string&) const;
|
2003-03-06 11:19:28 -05:00
|
|
|
/**
|
|
|
|
* Get the list of all variables in the current space. If argument
|
|
|
|
* cacheonly is specified and is greater than 0, then only cache
|
|
|
|
* variables will be listed.
|
|
|
|
*/
|
2015-06-07 15:12:51 +02:00
|
|
|
std::vector<std::string> GetDefinitions() const;
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2014-04-03 10:19:46 +02:00
|
|
|
/**
|
|
|
|
* Test a boolean variable to see if it is true or false.
|
|
|
|
* If the variable is not found in this makefile instance, the
|
|
|
|
* cache is then queried.
|
|
|
|
* Returns false if no entry defined.
|
2001-08-08 11:54:46 -04:00
|
|
|
*/
|
2014-02-04 16:06:56 -05:00
|
|
|
bool IsOn(const std::string& name) const;
|
|
|
|
bool IsSet(const std::string& name) const;
|
2001-01-11 14:47:38 -05:00
|
|
|
|
2016-06-10 16:11:18 +02:00
|
|
|
/** Return whether the target platform is 32-bit. */
|
|
|
|
bool PlatformIs32Bit() const;
|
|
|
|
|
2009-09-30 13:45:14 -04:00
|
|
|
/** Return whether the target platform is 64-bit. */
|
|
|
|
bool PlatformIs64Bit() const;
|
2017-02-27 21:06:51 +00:00
|
|
|
/** Return whether the target platform is x32. */
|
|
|
|
bool PlatformIsx32() const;
|
2009-09-30 13:45:14 -04:00
|
|
|
|
2017-11-04 15:27:48 +01:00
|
|
|
/** Apple SDK Type */
|
|
|
|
enum class AppleSDK
|
|
|
|
{
|
|
|
|
MacOS,
|
|
|
|
IPhoneOS,
|
|
|
|
IPhoneSimulator,
|
|
|
|
AppleTVOS,
|
|
|
|
AppleTVSimulator,
|
|
|
|
WatchOS,
|
|
|
|
WatchSimulator,
|
|
|
|
};
|
|
|
|
|
|
|
|
/** What SDK type points CMAKE_OSX_SYSROOT to? */
|
|
|
|
AppleSDK GetAppleSDKType() const;
|
|
|
|
|
2015-08-18 21:30:54 +02:00
|
|
|
/** Return whether the target platform is Apple iOS. */
|
2017-11-04 13:29:25 +01:00
|
|
|
bool PlatformIsAppleEmbedded() const;
|
2015-08-18 21:30:54 +02:00
|
|
|
|
2012-04-22 16:42:55 +03:00
|
|
|
/** Retrieve soname flag for the specified language if supported */
|
2014-02-03 21:20:56 -05:00
|
|
|
const char* GetSONameFlag(const std::string& language) const;
|
2012-04-22 16:42:55 +03:00
|
|
|
|
2001-01-05 11:41:20 -05:00
|
|
|
/**
|
2001-01-11 14:47:38 -05:00
|
|
|
* Get a list of preprocessor define flags.
|
2001-01-05 11:41:20 -05:00
|
|
|
*/
|
2016-10-09 10:47:45 +02:00
|
|
|
std::string GetDefineFlags() const { return this->DefineFlags; }
|
2006-03-22 14:40:36 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Make sure CMake can write this file
|
|
|
|
*/
|
2018-01-31 18:20:02 +03:00
|
|
|
bool CanIWriteThisFile(std::string const& fileName) const;
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2019-08-09 10:41:44 -04:00
|
|
|
#if !defined(CMAKE_BOOTSTRAP)
|
2001-03-20 13:20:59 -05:00
|
|
|
/**
|
|
|
|
* Get the vector source groups.
|
|
|
|
*/
|
|
|
|
const std::vector<cmSourceGroup>& GetSourceGroups() const
|
2016-05-16 10:34:04 -04:00
|
|
|
{
|
|
|
|
return this->SourceGroups;
|
|
|
|
}
|
2001-04-30 10:52:58 -04:00
|
|
|
|
2002-10-04 18:16:13 -04:00
|
|
|
/**
|
|
|
|
* Get the source group
|
|
|
|
*/
|
2016-05-16 10:34:04 -04:00
|
|
|
cmSourceGroup* GetSourceGroup(const std::vector<std::string>& name) const;
|
2017-09-07 11:42:29 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a root source group for consideration when adding a new source.
|
|
|
|
*/
|
|
|
|
void AddSourceGroup(const std::string& name, const char* regex = nullptr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a source group for consideration when adding a new source.
|
|
|
|
* name is tokenized.
|
|
|
|
*/
|
|
|
|
void AddSourceGroup(const std::vector<std::string>& name,
|
|
|
|
const char* regex = nullptr);
|
|
|
|
|
2017-09-07 11:55:52 +02:00
|
|
|
/**
|
|
|
|
* Get and existing or create a new source group.
|
|
|
|
*/
|
|
|
|
cmSourceGroup* GetOrCreateSourceGroup(
|
|
|
|
const std::vector<std::string>& folders);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get and existing or create a new source group.
|
|
|
|
* The name will be tokenized.
|
|
|
|
*/
|
|
|
|
cmSourceGroup* GetOrCreateSourceGroup(const std::string& name);
|
|
|
|
|
2017-09-07 11:42:29 +02:00
|
|
|
/**
|
|
|
|
* find what source group this source is in
|
|
|
|
*/
|
2018-01-22 20:47:53 -05:00
|
|
|
cmSourceGroup* FindSourceGroup(const std::string& source,
|
2017-09-07 11:42:29 +02:00
|
|
|
std::vector<cmSourceGroup>& groups) const;
|
2006-03-22 09:58:11 -05:00
|
|
|
#endif
|
2002-10-04 18:16:13 -04:00
|
|
|
|
2001-04-30 10:52:58 -04:00
|
|
|
/**
|
|
|
|
* Get the vector of list files on which this makefile depends
|
|
|
|
*/
|
|
|
|
const std::vector<std::string>& GetListFiles() const
|
2016-05-16 10:34:04 -04:00
|
|
|
{
|
|
|
|
return this->ListFiles;
|
|
|
|
}
|
2019-03-31 11:27:12 +02:00
|
|
|
//! When the file changes cmake will be re-run from the build system.
|
2013-06-18 13:41:50 -04:00
|
|
|
void AddCMakeDependFile(const std::string& file)
|
2016-05-16 10:34:04 -04:00
|
|
|
{
|
|
|
|
this->ListFiles.push_back(file);
|
|
|
|
}
|
2014-01-21 14:14:49 -05:00
|
|
|
void AddCMakeDependFilesFromUser();
|
2006-06-22 15:31:19 -04:00
|
|
|
|
2015-05-16 07:30:33 +02:00
|
|
|
std::string FormatListFileStack() const;
|
2006-06-22 15:31:19 -04:00
|
|
|
|
2008-03-13 13:48:57 -04:00
|
|
|
/**
|
|
|
|
* Get the current context backtrace.
|
|
|
|
*/
|
2014-05-23 14:41:46 -04:00
|
|
|
cmListFileBacktrace GetBacktrace() const;
|
2015-05-29 22:37:59 +02:00
|
|
|
cmListFileBacktrace GetBacktrace(cmCommandContext const& lfc) const;
|
2015-05-18 21:35:29 +02:00
|
|
|
cmListFileContext GetExecutionContext() const;
|
2008-03-13 13:48:57 -04:00
|
|
|
|
2006-04-10 13:53:00 -04:00
|
|
|
/**
|
|
|
|
* Get the vector of files created by this makefile
|
|
|
|
*/
|
|
|
|
const std::vector<std::string>& GetOutputFiles() const
|
2016-05-16 10:34:04 -04:00
|
|
|
{
|
|
|
|
return this->OutputFiles;
|
|
|
|
}
|
2013-06-18 13:41:50 -04:00
|
|
|
void AddCMakeOutputFile(const std::string& file)
|
2016-05-16 10:34:04 -04:00
|
|
|
{
|
|
|
|
this->OutputFiles.push_back(file);
|
|
|
|
}
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2001-02-12 19:49:52 -05:00
|
|
|
/**
|
2011-10-13 19:51:18 +02:00
|
|
|
* Expand all defined variables in the string.
|
2006-03-15 11:02:08 -05:00
|
|
|
* Defined variables come from the this->Definitions map.
|
2001-02-12 19:49:52 -05:00
|
|
|
* They are expanded with ${var} where var is the
|
2011-03-20 14:22:39 +01:00
|
|
|
* entry in the this->Definitions map. Also \@var\@ is
|
2001-02-13 16:48:00 -05:00
|
|
|
* expanded to match autoconf style expansions.
|
2001-02-12 19:49:52 -05:00
|
|
|
*/
|
2018-04-27 11:28:30 -04:00
|
|
|
const std::string& ExpandVariablesInString(std::string& source) const;
|
|
|
|
const std::string& ExpandVariablesInString(
|
|
|
|
std::string& source, bool escapeQuotes, bool noEscapes,
|
|
|
|
bool atOnly = false, const char* filename = nullptr, long line = -1,
|
|
|
|
bool removeEmpty = false, bool replaceAt = false) const;
|
2001-02-16 11:34:23 -05:00
|
|
|
|
2001-04-30 10:44:00 -04:00
|
|
|
/**
|
|
|
|
* Remove any remaining variables in the string. Anything with ${var} or
|
2011-03-20 14:22:39 +01:00
|
|
|
* \@var\@ will be removed.
|
2001-04-30 10:44:00 -04:00
|
|
|
*/
|
2016-05-16 10:34:04 -04:00
|
|
|
void RemoveVariablesInString(std::string& source, bool atOnly = false) const;
|
2001-04-30 10:44:00 -04:00
|
|
|
|
2001-02-16 11:34:23 -05:00
|
|
|
/**
|
|
|
|
* Expand variables in the makefiles ivars such as link directories etc
|
|
|
|
*/
|
2012-12-06 09:59:18 -05:00
|
|
|
void ExpandVariablesCMP0019();
|
2004-03-03 18:18:47 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Replace variables and #cmakedefine lines in the given string.
|
|
|
|
* See cmConfigureFileCommand for details.
|
|
|
|
*/
|
|
|
|
void ConfigureString(const std::string& input, std::string& output,
|
2014-01-22 16:33:56 +01:00
|
|
|
bool atOnly, bool escapeQuotes) const;
|
2004-03-03 18:18:47 -05:00
|
|
|
|
2004-03-09 07:50:45 -05:00
|
|
|
/**
|
2017-11-02 19:14:55 -04:00
|
|
|
* Copy file but change lines according to ConfigureString
|
2004-03-09 07:50:45 -05:00
|
|
|
*/
|
2019-02-18 09:54:51 -05:00
|
|
|
int ConfigureFile(const std::string& infile, const std::string& outfile,
|
|
|
|
bool copyonly, bool atOnly, bool escapeQuotes,
|
2017-06-02 21:01:01 +02:00
|
|
|
cmNewLineStyle = cmNewLineStyle());
|
2011-11-20 14:04:11 +01:00
|
|
|
|
2012-05-14 18:50:30 -04:00
|
|
|
/**
|
|
|
|
* Print a command's invocation
|
|
|
|
*/
|
2014-01-22 15:00:29 +01:00
|
|
|
void PrintCommandTrace(const cmListFileFunction& lff) const;
|
2012-05-14 18:50:30 -04:00
|
|
|
|
2019-07-27 00:21:01 +02:00
|
|
|
/**
|
|
|
|
* Set a callback that is invoked whenever ExecuteCommand is called.
|
|
|
|
*/
|
|
|
|
void OnExecuteCommand(std::function<void()> callback);
|
|
|
|
|
2001-07-25 16:53:13 -04:00
|
|
|
/**
|
2002-12-12 11:36:28 -05:00
|
|
|
* Execute a single CMake command. Returns true if the command
|
|
|
|
* succeeded or false if it failed.
|
2001-07-25 16:53:13 -04:00
|
|
|
*/
|
2011-10-13 19:51:18 +02:00
|
|
|
bool ExecuteCommand(const cmListFileFunction& lff,
|
2016-05-16 10:34:04 -04:00
|
|
|
cmExecutionStatus& status);
|
2008-01-23 10:28:26 -05:00
|
|
|
|
2019-03-31 11:27:12 +02:00
|
|
|
//! Enable support for named language, if nil then all languages are
|
2016-05-16 10:34:04 -04:00
|
|
|
/// enabled.
|
|
|
|
void EnableLanguage(std::vector<std::string> const& languages,
|
|
|
|
bool optional);
|
2002-05-01 16:33:27 -04:00
|
|
|
|
2016-05-16 10:34:04 -04:00
|
|
|
cmState* GetState() const;
|
2004-10-27 10:47:14 -04:00
|
|
|
|
2016-05-16 10:34:04 -04:00
|
|
|
/**
|
|
|
|
* Get the variable watch. This is used to determine when certain variables
|
|
|
|
* are accessed.
|
|
|
|
*/
|
2019-08-09 10:41:44 -04:00
|
|
|
#ifndef CMAKE_BOOTSTRAP
|
2003-01-08 12:59:52 -05:00
|
|
|
cmVariableWatch* GetVariableWatch() const;
|
2004-10-27 10:47:14 -04:00
|
|
|
#endif
|
2002-08-28 14:51:10 -04:00
|
|
|
|
2019-03-31 11:27:12 +02:00
|
|
|
//! Display progress or status message.
|
2019-02-11 10:30:00 -05:00
|
|
|
void DisplayStatus(const std::string&, float) const;
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2002-12-11 18:13:33 -05:00
|
|
|
/**
|
|
|
|
* Expand the given list file arguments into the full set after
|
|
|
|
* variable replacement and list expansion.
|
|
|
|
*/
|
2008-09-24 08:51:33 -04:00
|
|
|
bool ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
|
2015-05-23 20:32:05 +02:00
|
|
|
std::vector<std::string>& outArgs,
|
2017-08-22 23:42:36 +02:00
|
|
|
const char* filename = nullptr) const;
|
2014-09-04 20:21:28 +02:00
|
|
|
|
|
|
|
bool ExpandArguments(std::vector<cmListFileArgument> const& inArgs,
|
2015-05-23 20:32:05 +02:00
|
|
|
std::vector<cmExpandedCommandArgument>& outArgs,
|
2017-08-22 23:42:36 +02:00
|
|
|
const char* filename = nullptr) const;
|
2014-09-04 20:21:28 +02:00
|
|
|
|
2003-01-20 16:59:02 -05:00
|
|
|
/**
|
|
|
|
* Get the instance
|
2011-10-13 19:51:18 +02:00
|
|
|
*/
|
2016-05-16 10:34:04 -04:00
|
|
|
cmake* GetCMakeInstance() const;
|
2016-01-28 22:10:28 +01:00
|
|
|
cmMessenger* GetMessenger() const;
|
2015-05-03 11:08:21 +02:00
|
|
|
cmGlobalGenerator* GetGlobalGenerator() const;
|
2003-01-20 16:59:02 -05:00
|
|
|
|
2003-06-03 10:30:23 -04:00
|
|
|
/**
|
|
|
|
* Get all the source files this makefile knows about
|
|
|
|
*/
|
2020-01-12 16:58:54 +01:00
|
|
|
const std::vector<std::unique_ptr<cmSourceFile>>& GetSourceFiles() const
|
2016-05-16 10:34:04 -04:00
|
|
|
{
|
|
|
|
return this->SourceFiles;
|
|
|
|
}
|
2003-06-03 10:30:23 -04:00
|
|
|
|
|
|
|
/**
|
2019-09-11 12:19:43 +02:00
|
|
|
* Return the target if the provided source name is a byproduct of a utility
|
|
|
|
* target or a PRE_BUILD, PRE_LINK, or POST_BUILD command.
|
|
|
|
* Return the source file which has the provided source name as output.
|
|
|
|
*/
|
|
|
|
cmSourcesWithOutput GetSourcesWithOutput(const std::string& name) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is there a source file that has the provided source name as an output?
|
|
|
|
* If so then return it.
|
2003-06-03 10:30:23 -04:00
|
|
|
*/
|
2019-09-11 12:19:43 +02:00
|
|
|
cmSourceFile* GetSourceFileWithOutput(
|
|
|
|
const std::string& name,
|
|
|
|
cmSourceOutputKind kind = cmSourceOutputKind::OutputOnly) const;
|
2003-08-06 18:54:13 -04:00
|
|
|
|
2019-03-31 11:27:12 +02:00
|
|
|
//! Add a new cmTest to the list of tests for this makefile.
|
2014-02-03 21:20:33 -05:00
|
|
|
cmTest* CreateTest(const std::string& testName);
|
2005-04-24 15:59:51 -04:00
|
|
|
|
|
|
|
/** Get a cmTest pointer for a given test name, if the name is
|
|
|
|
* not found, then a null pointer is returned.
|
|
|
|
*/
|
2014-02-03 21:20:33 -05:00
|
|
|
cmTest* GetTest(const std::string& testName) const;
|
2005-04-24 15:59:51 -04:00
|
|
|
|
2017-11-14 13:42:32 -08:00
|
|
|
/**
|
|
|
|
* Get all tests that run under the given configuration.
|
|
|
|
*/
|
|
|
|
void GetTests(const std::string& config, std::vector<cmTest*>& tests);
|
|
|
|
|
2004-02-28 18:59:19 -05:00
|
|
|
/**
|
|
|
|
* Return a location of a file in cmake or custom modules directory
|
|
|
|
*/
|
2019-01-21 12:56:51 -05:00
|
|
|
std::string GetModulesFile(const std::string& name) const
|
2018-10-31 13:26:04 -04:00
|
|
|
{
|
|
|
|
bool system;
|
2019-10-04 17:18:26 -04:00
|
|
|
std::string debugBuffer;
|
|
|
|
return this->GetModulesFile(name, system, false, debugBuffer);
|
2018-10-31 13:26:04 -04:00
|
|
|
}
|
|
|
|
|
2019-10-04 17:18:26 -04:00
|
|
|
/**
|
|
|
|
* Return a location of a file in cmake or custom modules directory
|
|
|
|
*/
|
|
|
|
std::string GetModulesFile(const std::string& name, bool& system) const
|
|
|
|
{
|
|
|
|
std::string debugBuffer;
|
|
|
|
return this->GetModulesFile(name, system, false, debugBuffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string GetModulesFile(const std::string& name, bool& system, bool debug,
|
|
|
|
std::string& debugBuffer) const;
|
2004-04-23 12:52:48 -04:00
|
|
|
|
2019-03-31 11:27:12 +02:00
|
|
|
//! Set/Get a property of this directory
|
2016-05-16 10:34:04 -04:00
|
|
|
void SetProperty(const std::string& prop, const char* value);
|
|
|
|
void AppendProperty(const std::string& prop, const char* value,
|
|
|
|
bool asString = false);
|
|
|
|
const char* GetProperty(const std::string& prop) const;
|
|
|
|
const char* GetProperty(const std::string& prop, bool chain) const;
|
2013-09-02 16:27:32 -04:00
|
|
|
bool GetPropertyAsBool(const std::string& prop) const;
|
2015-07-18 18:59:18 +02:00
|
|
|
std::vector<std::string> GetPropertyKeys() const;
|
2004-05-20 16:56:34 -04:00
|
|
|
|
2019-03-31 11:27:12 +02:00
|
|
|
//! Initialize a makefile from its parent
|
2015-06-06 09:17:45 +02:00
|
|
|
void InitializeFromParent(cmMakefile* parent);
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2020-01-12 16:58:54 +01:00
|
|
|
void AddInstallGenerator(std::unique_ptr<cmInstallGenerator> g);
|
|
|
|
|
|
|
|
std::vector<std::unique_ptr<cmInstallGenerator>>& GetInstallGenerators()
|
2016-05-16 10:34:04 -04:00
|
|
|
{
|
|
|
|
return this->InstallGenerators;
|
|
|
|
}
|
2020-01-12 16:58:54 +01:00
|
|
|
const std::vector<std::unique_ptr<cmInstallGenerator>>&
|
|
|
|
GetInstallGenerators() const
|
2017-10-12 17:16:57 -07:00
|
|
|
{
|
|
|
|
return this->InstallGenerators;
|
|
|
|
}
|
2006-12-07 09:45:32 -05:00
|
|
|
|
2020-01-12 16:58:54 +01:00
|
|
|
void AddTestGenerator(std::unique_ptr<cmTestGenerator> g);
|
|
|
|
|
|
|
|
const std::vector<std::unique_ptr<cmTestGenerator>>& GetTestGenerators()
|
|
|
|
const
|
2016-05-16 10:34:04 -04:00
|
|
|
{
|
|
|
|
return this->TestGenerators;
|
|
|
|
}
|
2009-03-16 10:40:46 -04:00
|
|
|
|
2015-05-31 18:19:58 +02:00
|
|
|
class FunctionPushPop
|
|
|
|
{
|
|
|
|
public:
|
2015-05-31 19:37:08 +02:00
|
|
|
FunctionPushPop(cmMakefile* mf, std::string const& fileName,
|
2015-05-31 18:19:58 +02:00
|
|
|
cmPolicies::PolicyMap const& pm);
|
|
|
|
~FunctionPushPop();
|
|
|
|
|
2019-02-14 17:29:57 +01:00
|
|
|
FunctionPushPop(const FunctionPushPop&) = delete;
|
|
|
|
FunctionPushPop& operator=(const FunctionPushPop&) = delete;
|
|
|
|
|
2015-05-31 18:19:58 +02:00
|
|
|
void Quiet() { this->ReportError = false; }
|
2018-06-01 09:53:41 -04:00
|
|
|
|
2015-05-31 18:19:58 +02:00
|
|
|
private:
|
|
|
|
cmMakefile* Makefile;
|
|
|
|
bool ReportError;
|
|
|
|
};
|
|
|
|
|
2015-05-31 18:32:01 +02:00
|
|
|
class MacroPushPop
|
|
|
|
{
|
|
|
|
public:
|
2015-05-31 19:37:08 +02:00
|
|
|
MacroPushPop(cmMakefile* mf, std::string const& fileName,
|
|
|
|
cmPolicies::PolicyMap const& pm);
|
2015-05-31 18:32:01 +02:00
|
|
|
~MacroPushPop();
|
|
|
|
|
2019-02-14 17:29:57 +01:00
|
|
|
MacroPushPop(const MacroPushPop&) = delete;
|
|
|
|
MacroPushPop& operator=(const MacroPushPop&) = delete;
|
|
|
|
|
2015-05-31 18:32:01 +02:00
|
|
|
void Quiet() { this->ReportError = false; }
|
2018-06-01 09:53:41 -04:00
|
|
|
|
2015-05-31 18:32:01 +02:00
|
|
|
private:
|
|
|
|
cmMakefile* Makefile;
|
|
|
|
bool ReportError;
|
|
|
|
};
|
|
|
|
|
2015-05-31 19:37:08 +02:00
|
|
|
void PushFunctionScope(std::string const& fileName,
|
|
|
|
cmPolicies::PolicyMap const& pm);
|
2015-05-31 18:19:58 +02:00
|
|
|
void PopFunctionScope(bool reportError);
|
2015-05-31 19:37:08 +02:00
|
|
|
void PushMacroScope(std::string const& fileName,
|
|
|
|
cmPolicies::PolicyMap const& pm);
|
2015-05-31 18:32:01 +02:00
|
|
|
void PopMacroScope(bool reportError);
|
2007-12-03 13:35:41 -05:00
|
|
|
void PushScope();
|
|
|
|
void PopScope();
|
2016-05-16 10:34:04 -04:00
|
|
|
void RaiseScope(const std::string& var, const char* value);
|
2007-12-03 13:35:41 -05:00
|
|
|
|
2014-11-18 16:34:30 +01:00
|
|
|
// push and pop loop scopes
|
|
|
|
void PushLoopBlockBarrier();
|
|
|
|
void PopLoopBlockBarrier();
|
|
|
|
|
2009-01-14 15:14:06 -05:00
|
|
|
/** Helper class to push and pop scopes automatically. */
|
|
|
|
class ScopePushPop
|
|
|
|
{
|
|
|
|
public:
|
2016-05-16 10:34:04 -04:00
|
|
|
ScopePushPop(cmMakefile* m)
|
|
|
|
: Makefile(m)
|
|
|
|
{
|
|
|
|
this->Makefile->PushScope();
|
|
|
|
}
|
2019-01-23 20:30:01 +01:00
|
|
|
|
2009-01-14 15:14:06 -05:00
|
|
|
~ScopePushPop() { this->Makefile->PopScope(); }
|
2018-06-01 09:53:41 -04:00
|
|
|
|
2019-01-23 20:30:01 +01:00
|
|
|
ScopePushPop(ScopePushPop const&) = delete;
|
|
|
|
ScopePushPop& operator=(ScopePushPop const&) = delete;
|
|
|
|
|
2009-01-14 15:14:06 -05:00
|
|
|
private:
|
|
|
|
cmMakefile* Makefile;
|
|
|
|
};
|
|
|
|
|
2018-11-22 03:36:50 +00:00
|
|
|
void IssueMessage(MessageType t, std::string const& text) const;
|
2008-03-07 08:40:36 -05:00
|
|
|
|
2008-03-31 13:33:09 -04:00
|
|
|
/** Set whether or not to report a CMP0000 violation. */
|
|
|
|
void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; }
|
|
|
|
|
2017-10-25 13:54:26 -04:00
|
|
|
bool CheckCMP0037(std::string const& targetName,
|
|
|
|
cmStateEnums::TargetType targetType) const;
|
|
|
|
|
2015-07-18 10:52:09 +02:00
|
|
|
cmStringRange GetIncludeDirectoriesEntries() const;
|
|
|
|
cmBacktraceRange GetIncludeDirectoriesBacktraces() const;
|
|
|
|
cmStringRange GetCompileOptionsEntries() const;
|
|
|
|
cmBacktraceRange GetCompileOptionsBacktraces() const;
|
|
|
|
cmStringRange GetCompileDefinitionsEntries() const;
|
|
|
|
cmBacktraceRange GetCompileDefinitionsBacktraces() const;
|
2018-04-24 17:01:01 +02:00
|
|
|
cmStringRange GetLinkOptionsEntries() const;
|
|
|
|
cmBacktraceRange GetLinkOptionsBacktraces() const;
|
2018-09-14 17:48:20 +02:00
|
|
|
cmStringRange GetLinkDirectoriesEntries() const;
|
|
|
|
cmBacktraceRange GetLinkDirectoriesBacktraces() const;
|
2012-11-19 22:47:30 +01:00
|
|
|
|
2016-05-16 10:34:04 -04:00
|
|
|
std::set<std::string> const& GetSystemIncludeDirectories() const
|
|
|
|
{
|
|
|
|
return this->SystemIncludeDirectories;
|
|
|
|
}
|
2013-07-01 22:55:25 +02:00
|
|
|
|
2014-04-02 14:02:03 -04:00
|
|
|
bool PolicyOptionalWarningEnabled(std::string const& var);
|
|
|
|
|
2016-05-16 10:34:04 -04:00
|
|
|
bool AddRequiredTargetFeature(cmTarget* target, const std::string& feature,
|
2017-08-22 23:42:36 +02:00
|
|
|
std::string* error = nullptr) const;
|
2014-04-02 15:57:15 +02:00
|
|
|
|
2014-05-15 11:33:20 +02:00
|
|
|
bool CompileFeatureKnown(cmTarget const* target, const std::string& feature,
|
2016-05-16 10:34:04 -04:00
|
|
|
std::string& lang, std::string* error) const;
|
2014-05-15 11:33:20 +02:00
|
|
|
|
2014-05-15 11:33:20 +02:00
|
|
|
const char* CompileFeaturesAvailable(const std::string& lang,
|
2016-05-16 10:34:04 -04:00
|
|
|
std::string* error) const;
|
2014-05-15 11:33:20 +02:00
|
|
|
|
2015-01-11 17:43:44 +01:00
|
|
|
bool HaveStandardAvailable(cmTarget const* target, std::string const& lang,
|
2016-05-16 10:34:04 -04:00
|
|
|
const std::string& feature) const;
|
2014-05-15 11:54:24 +02:00
|
|
|
|
2016-05-16 10:34:04 -04:00
|
|
|
bool IsLaterStandard(std::string const& lang, std::string const& lhs,
|
2014-05-15 11:32:30 +02:00
|
|
|
std::string const& rhs);
|
|
|
|
|
2014-11-18 16:34:30 +01:00
|
|
|
void PushLoopBlock();
|
|
|
|
void PopLoopBlock();
|
|
|
|
bool IsLoopBlock() const;
|
|
|
|
|
2014-12-01 10:51:49 -05:00
|
|
|
void ClearMatches();
|
|
|
|
void StoreMatches(cmsys::RegularExpression& re);
|
|
|
|
|
2016-10-18 21:28:48 +02:00
|
|
|
cmStateSnapshot GetStateSnapshot() const;
|
2015-06-04 19:42:32 +02:00
|
|
|
|
2015-06-07 14:50:54 +02:00
|
|
|
const char* GetDefineFlagsCMP0059() const;
|
|
|
|
|
2015-05-23 20:32:05 +02:00
|
|
|
std::string GetExecutionFilePath() const;
|
|
|
|
|
2015-06-21 23:00:44 +02:00
|
|
|
void EnforceDirectoryLevelRules() const;
|
|
|
|
|
2017-09-21 23:06:05 +02:00
|
|
|
void AddEvaluationFile(
|
|
|
|
const std::string& inputFile,
|
|
|
|
std::unique_ptr<cmCompiledGeneratorExpression> outputName,
|
|
|
|
std::unique_ptr<cmCompiledGeneratorExpression> condition,
|
|
|
|
bool inputIsContent);
|
2020-01-12 16:58:54 +01:00
|
|
|
const std::vector<std::unique_ptr<cmGeneratorExpressionEvaluationFile>>&
|
|
|
|
GetEvaluationFiles() const;
|
2015-08-01 12:05:13 +02:00
|
|
|
|
2016-05-16 10:34:04 -04:00
|
|
|
std::vector<cmExportBuildFileGenerator*> GetExportBuildFileGenerators()
|
|
|
|
const;
|
2015-09-16 22:08:22 +02:00
|
|
|
void RemoveExportBuildFileGeneratorCMP0024(cmExportBuildFileGenerator* gen);
|
|
|
|
void AddExportBuildFileGenerator(cmExportBuildFileGenerator* gen);
|
|
|
|
|
2018-03-15 13:22:07 -04:00
|
|
|
// Maintain a stack of package roots to allow nested PACKAGE_ROOT_PATH
|
|
|
|
// searches
|
|
|
|
std::deque<std::vector<std::string>> FindPackageRootPathStack;
|
|
|
|
|
|
|
|
void MaybeWarnCMP0074(std::string const& pkg);
|
2018-12-13 20:45:11 +01:00
|
|
|
void MaybeWarnUninitialized(std::string const& variable,
|
|
|
|
const char* sourceFilename) const;
|
2018-12-13 20:44:58 +01:00
|
|
|
bool IsProjectFile(const char* filename) const;
|
2017-05-03 13:56:03 -04:00
|
|
|
|
2018-12-14 17:24:52 -05:00
|
|
|
int GetRecursionDepth() const;
|
|
|
|
void SetRecursionDepth(int recursionDepth);
|
|
|
|
|
2000-08-29 15:26:29 -04:00
|
|
|
protected:
|
2002-05-02 15:56:13 -04:00
|
|
|
// add link libraries and directories to the target
|
2016-10-07 20:13:36 +02:00
|
|
|
void AddGlobalLinkInformation(cmTarget& target);
|
2010-09-14 15:22:31 -04:00
|
|
|
|
|
|
|
// Check for a an unused variable
|
2015-05-17 16:28:39 +02:00
|
|
|
void LogUnused(const char* reason, const std::string& name) const;
|
2010-09-14 15:22:31 -04:00
|
|
|
|
2015-06-06 09:45:56 +02:00
|
|
|
mutable std::set<cmListFileContext> CMP0054ReportedIds;
|
|
|
|
|
2001-04-11 14:59:02 -04:00
|
|
|
// libraries, classes, and executables
|
2019-05-23 12:52:36 +02:00
|
|
|
mutable cmTargetMap Targets;
|
2015-10-25 12:43:00 +01:00
|
|
|
std::map<std::string, std::string> AliasTargets;
|
2017-10-26 22:41:04 -07:00
|
|
|
|
2019-09-11 12:19:43 +02:00
|
|
|
using TargetsVec = std::vector<cmTarget*>;
|
|
|
|
TargetsVec OrderedTargets;
|
|
|
|
|
2020-01-12 16:58:54 +01:00
|
|
|
std::vector<std::unique_ptr<cmSourceFile>> SourceFiles;
|
2017-10-26 22:41:04 -07:00
|
|
|
|
|
|
|
// Because cmSourceFile names are compared in a fuzzy way (see
|
|
|
|
// cmSourceFileLocation::Match()) we can't have a straight mapping from
|
|
|
|
// filename to cmSourceFile. To make lookups more efficient we store the
|
|
|
|
// Name portion of the cmSourceFileLocation and then compare on the list of
|
|
|
|
// cmSourceFiles that might match that name. Note that on platforms which
|
|
|
|
// have a case-insensitive filesystem we store the key in all lowercase.
|
2020-01-12 16:58:54 +01:00
|
|
|
using SourceFileMap =
|
|
|
|
std::unordered_map<std::string, std::vector<cmSourceFile*>>;
|
2017-10-26 22:41:04 -07:00
|
|
|
SourceFileMap SourceFileSearchIndex;
|
2001-04-11 14:59:02 -04:00
|
|
|
|
2018-02-13 18:18:50 +01:00
|
|
|
// For "Known" paths we can store a direct filename to cmSourceFile map
|
|
|
|
std::unordered_map<std::string, cmSourceFile*> KnownFileSearchIndex;
|
|
|
|
|
2005-04-24 15:59:51 -04:00
|
|
|
// Tests
|
2020-01-12 16:58:54 +01:00
|
|
|
std::map<std::string, std::unique_ptr<cmTest>> Tests;
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2006-10-05 08:55:59 -04:00
|
|
|
// The set of include directories that are marked as system include
|
|
|
|
// directories.
|
2014-02-10 00:21:34 -05:00
|
|
|
std::set<std::string> SystemIncludeDirectories;
|
2006-10-05 08:55:59 -04:00
|
|
|
|
2015-04-04 15:47:49 +02:00
|
|
|
std::vector<std::string> ListFiles;
|
|
|
|
std::vector<std::string> OutputFiles;
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2020-01-12 16:58:54 +01:00
|
|
|
std::vector<std::unique_ptr<cmInstallGenerator>> InstallGenerators;
|
|
|
|
std::vector<std::unique_ptr<cmTestGenerator>> TestGenerators;
|
2006-03-15 11:02:08 -05:00
|
|
|
|
|
|
|
std::string ComplainFileRegularExpression;
|
|
|
|
std::string DefineFlags;
|
2006-03-22 09:58:11 -05:00
|
|
|
|
2008-06-26 13:30:10 -04:00
|
|
|
// Track the value of the computed DEFINITIONS property.
|
|
|
|
std::string DefineFlagsOrig;
|
|
|
|
|
2019-08-09 10:41:44 -04:00
|
|
|
#if !defined(CMAKE_BOOTSTRAP)
|
2006-03-15 11:02:08 -05:00
|
|
|
std::vector<cmSourceGroup> SourceGroups;
|
2017-04-10 14:48:57 -04:00
|
|
|
size_t ObjectLibrariesSourceGroupIndex;
|
2006-03-22 09:58:11 -05:00
|
|
|
#endif
|
|
|
|
|
2015-08-02 11:20:28 +02:00
|
|
|
cmGlobalGenerator* GlobalGenerator;
|
2011-10-13 19:51:18 +02:00
|
|
|
bool IsFunctionBlocked(const cmListFileFunction& lff,
|
2016-05-16 10:34:04 -04:00
|
|
|
cmExecutionStatus& status);
|
2011-10-13 19:51:18 +02:00
|
|
|
|
2001-01-11 14:47:38 -05:00
|
|
|
private:
|
2016-10-18 21:28:48 +02:00
|
|
|
cmStateSnapshot StateSnapshot;
|
2016-04-14 11:24:08 -04:00
|
|
|
cmListFileBacktrace Backtrace;
|
2018-12-14 17:24:52 -05:00
|
|
|
int RecursionDepth;
|
2015-04-18 14:50:33 +02:00
|
|
|
|
2019-10-17 15:40:09 +02:00
|
|
|
void DoGenerate(cmLocalGenerator& lg);
|
|
|
|
|
2015-06-21 20:07:40 +02:00
|
|
|
void ReadListFile(cmListFile const& listFile,
|
|
|
|
const std::string& filenametoread);
|
2015-04-18 14:50:32 +02:00
|
|
|
|
2008-01-17 19:29:43 -05:00
|
|
|
bool ParseDefineFlag(std::string const& definition, bool remove);
|
|
|
|
|
2014-02-07 15:33:35 -05:00
|
|
|
bool EnforceUniqueDir(const std::string& srcPath,
|
|
|
|
const std::string& binPath) const;
|
2009-06-17 13:40:09 -04:00
|
|
|
|
2019-07-27 00:21:01 +02:00
|
|
|
std::function<void()> ExecuteCommandCallback;
|
2019-07-26 23:45:50 +02:00
|
|
|
using FunctionBlockerPtr = std::unique_ptr<cmFunctionBlocker>;
|
|
|
|
using FunctionBlockersType =
|
|
|
|
std::stack<FunctionBlockerPtr, std::vector<FunctionBlockerPtr>>;
|
2009-01-21 09:48:00 -05:00
|
|
|
FunctionBlockersType FunctionBlockers;
|
|
|
|
std::vector<FunctionBlockersType::size_type> FunctionBlockerBarriers;
|
|
|
|
void PushFunctionBlockerBarrier();
|
|
|
|
void PopFunctionBlockerBarrier(bool reportError = true);
|
2003-01-14 09:53:13 -05:00
|
|
|
|
2014-11-18 16:34:30 +01:00
|
|
|
std::stack<int> LoopBlockCounter;
|
|
|
|
|
2014-01-22 16:33:56 +01:00
|
|
|
mutable cmsys::RegularExpression cmDefineRegex;
|
|
|
|
mutable cmsys::RegularExpression cmDefine01Regex;
|
2014-01-22 15:00:29 +01:00
|
|
|
mutable cmsys::RegularExpression cmAtVarRegex;
|
2014-02-07 22:37:54 -05:00
|
|
|
mutable cmsys::RegularExpression cmNamedCurly;
|
2004-05-20 16:56:34 -04:00
|
|
|
|
2015-06-03 00:55:00 +02:00
|
|
|
std::vector<cmMakefile*> UnConfiguredDirectories;
|
2015-09-16 22:08:22 +02:00
|
|
|
std::vector<cmExportBuildFileGenerator*> ExportBuildFileGenerators;
|
2015-05-30 19:39:08 +02:00
|
|
|
|
2020-01-12 16:58:54 +01:00
|
|
|
std::vector<std::unique_ptr<cmGeneratorExpressionEvaluationFile>>
|
|
|
|
EvaluationFiles;
|
2015-08-01 12:05:13 +02:00
|
|
|
|
2015-05-31 19:37:08 +02:00
|
|
|
std::vector<cmExecutionStatus*> ExecutionStatusStack;
|
2008-03-07 08:40:36 -05:00
|
|
|
friend class cmMakefileCall;
|
2015-07-05 19:28:45 +02:00
|
|
|
friend class cmParseFileScope;
|
2008-03-07 08:40:36 -05:00
|
|
|
|
2020-01-12 16:58:54 +01:00
|
|
|
std::vector<std::unique_ptr<cmTarget>> ImportedTargetsOwned;
|
2019-08-23 23:25:56 +02:00
|
|
|
using TargetMap = std::unordered_map<std::string, cmTarget*>;
|
2014-04-30 13:27:33 -04:00
|
|
|
TargetMap ImportedTargets;
|
2009-01-22 10:57:09 -05:00
|
|
|
|
|
|
|
// Internal policy stack management.
|
2009-01-22 13:16:27 -05:00
|
|
|
void PushPolicy(bool weak = false,
|
|
|
|
cmPolicies::PolicyMap const& pm = cmPolicies::PolicyMap());
|
2009-01-22 10:57:16 -05:00
|
|
|
void PopPolicy();
|
2015-11-24 11:44:57 -05:00
|
|
|
void PopSnapshot(bool reportError = true);
|
2019-08-09 12:09:39 +02:00
|
|
|
friend bool cmCMakePolicyCommand(std::vector<std::string> const& args,
|
|
|
|
cmExecutionStatus& status);
|
2009-01-22 10:57:16 -05:00
|
|
|
class IncludeScope;
|
|
|
|
friend class IncludeScope;
|
2016-09-01 20:59:28 +02:00
|
|
|
|
2019-09-21 00:55:34 +02:00
|
|
|
class ListFileScope;
|
2015-06-21 22:50:13 +02:00
|
|
|
friend class ListFileScope;
|
2016-09-01 20:59:28 +02:00
|
|
|
|
2019-09-21 00:55:34 +02:00
|
|
|
class BuildsystemFileScope;
|
2015-06-21 22:50:13 +02:00
|
|
|
friend class BuildsystemFileScope;
|
2009-01-22 10:57:09 -05:00
|
|
|
|
2014-02-07 22:37:54 -05:00
|
|
|
// CMP0053 == old
|
2018-11-22 03:36:50 +00:00
|
|
|
MessageType ExpandVariablesInStringOld(std::string& errorstr,
|
|
|
|
std::string& source,
|
|
|
|
bool escapeQuotes, bool noEscapes,
|
|
|
|
bool atOnly, const char* filename,
|
|
|
|
long line, bool removeEmpty,
|
|
|
|
bool replaceAt) const;
|
2014-02-07 22:37:54 -05:00
|
|
|
// CMP0053 == new
|
2018-11-22 03:36:50 +00:00
|
|
|
MessageType ExpandVariablesInStringNew(std::string& errorstr,
|
|
|
|
std::string& source,
|
|
|
|
bool escapeQuotes, bool noEscapes,
|
|
|
|
bool atOnly, const char* filename,
|
|
|
|
long line, bool replaceAt) const;
|
2019-09-06 19:17:37 +02:00
|
|
|
|
2019-09-14 14:16:14 +02:00
|
|
|
bool ValidateCustomCommand(const cmCustomCommandLines& commandLines) const;
|
|
|
|
|
2019-10-17 17:02:20 +02:00
|
|
|
void CreateGeneratedOutputs(const std::vector<std::string>& outputs);
|
|
|
|
void CreateGeneratedByproducts(const std::vector<std::string>& byproducts);
|
2019-09-14 22:59:05 +02:00
|
|
|
|
2019-10-17 15:40:09 +02:00
|
|
|
std::vector<BT<GeneratorAction>> GeneratorActions;
|
|
|
|
bool GeneratorActionsInvoked = false;
|
2019-10-17 17:02:20 +02:00
|
|
|
bool DelayedOutputFilesHaveGenex = false;
|
|
|
|
std::vector<std::string> DelayedOutputFiles;
|
|
|
|
|
|
|
|
void AddDelayedOutput(std::string const& output);
|
2019-10-17 15:40:09 +02:00
|
|
|
|
2013-08-06 18:12:50 +02:00
|
|
|
/**
|
2019-09-11 12:19:43 +02:00
|
|
|
* See LinearGetSourceFileWithOutput for background information
|
|
|
|
*/
|
|
|
|
cmTarget* LinearGetTargetWithOutput(const std::string& name) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generalized old version of GetSourceFileWithOutput kept for
|
|
|
|
* backward-compatibility. It implements a linear search and supports
|
|
|
|
* relative file paths. It is used as a fall back by GetSourceFileWithOutput
|
|
|
|
* and GetSourcesWithOutput.
|
2013-08-06 18:12:50 +02:00
|
|
|
*/
|
2019-09-11 12:19:43 +02:00
|
|
|
cmSourceFile* LinearGetSourceFileWithOutput(const std::string& name,
|
|
|
|
cmSourceOutputKind kind,
|
|
|
|
bool& byproduct) const;
|
|
|
|
|
|
|
|
struct SourceEntry
|
|
|
|
{
|
|
|
|
cmSourcesWithOutput Sources;
|
2019-10-17 17:02:20 +02:00
|
|
|
bool SourceMightBeOutput = false;
|
2019-09-11 12:19:43 +02:00
|
|
|
};
|
2013-08-06 18:12:50 +02:00
|
|
|
|
2016-10-21 23:52:51 +02:00
|
|
|
// A map for fast output to input look up.
|
2019-09-11 12:19:43 +02:00
|
|
|
using OutputToSourceMap = std::unordered_map<std::string, SourceEntry>;
|
2013-08-06 18:12:50 +02:00
|
|
|
OutputToSourceMap OutputToSource;
|
|
|
|
|
2019-09-11 12:19:43 +02:00
|
|
|
void UpdateOutputToSourceMap(std::string const& byproduct, cmTarget* target);
|
|
|
|
void UpdateOutputToSourceMap(std::string const& output, cmSourceFile* source,
|
|
|
|
bool byproduct);
|
2013-07-25 09:24:53 +02:00
|
|
|
|
2019-09-14 22:59:05 +02:00
|
|
|
/**
|
|
|
|
* Return if the provided source file might have a custom command.
|
|
|
|
*/
|
|
|
|
bool MightHaveCustomCommand(const std::string& name) const;
|
|
|
|
|
2016-01-28 22:10:27 +01:00
|
|
|
bool AddRequiredTargetCFeature(cmTarget* target, const std::string& feature,
|
2019-09-17 19:21:09 +02:00
|
|
|
std::string const& lang,
|
2017-08-22 23:42:36 +02:00
|
|
|
std::string* error = nullptr) const;
|
2016-05-16 10:34:04 -04:00
|
|
|
bool AddRequiredTargetCxxFeature(cmTarget* target,
|
2016-01-28 22:10:27 +01:00
|
|
|
const std::string& feature,
|
2019-09-17 19:21:09 +02:00
|
|
|
std::string const& lang,
|
2017-08-22 23:42:36 +02:00
|
|
|
std::string* error = nullptr) const;
|
2019-11-01 08:12:05 -04:00
|
|
|
bool AddRequiredTargetCudaFeature(cmTarget* target,
|
|
|
|
const std::string& feature,
|
|
|
|
std::string const& lang,
|
|
|
|
std::string* error = nullptr) const;
|
2014-05-15 11:49:02 +02:00
|
|
|
|
2019-09-17 19:21:09 +02:00
|
|
|
void CheckNeededCLanguage(const std::string& feature,
|
|
|
|
std::string const& lang, bool& needC90,
|
2014-05-15 11:49:02 +02:00
|
|
|
bool& needC99, bool& needC11) const;
|
2019-09-17 19:21:09 +02:00
|
|
|
void CheckNeededCxxLanguage(const std::string& feature,
|
|
|
|
std::string const& lang, bool& needCxx98,
|
2016-11-30 15:25:01 -05:00
|
|
|
bool& needCxx11, bool& needCxx14,
|
2018-03-26 11:55:15 -04:00
|
|
|
bool& needCxx17, bool& needCxx20) const;
|
2019-11-01 08:12:05 -04:00
|
|
|
void CheckNeededCudaLanguage(const std::string& feature,
|
|
|
|
std::string const& lang, bool& needCuda03,
|
|
|
|
bool& needCuda11, bool& needCuda14,
|
|
|
|
bool& needCuda17, bool& needCuda20) const;
|
2014-05-15 11:54:24 +02:00
|
|
|
|
2015-01-11 17:43:44 +01:00
|
|
|
bool HaveCStandardAvailable(cmTarget const* target,
|
2019-09-17 19:21:09 +02:00
|
|
|
const std::string& feature,
|
|
|
|
std::string const& lang) const;
|
2015-01-11 17:43:44 +01:00
|
|
|
bool HaveCxxStandardAvailable(cmTarget const* target,
|
2019-09-17 19:21:09 +02:00
|
|
|
const std::string& feature,
|
|
|
|
std::string const& lang) const;
|
2019-11-01 08:12:05 -04:00
|
|
|
bool HaveCudaStandardAvailable(cmTarget const* target,
|
|
|
|
const std::string& feature,
|
|
|
|
std::string const& lang) const;
|
2014-05-20 17:00:28 -04:00
|
|
|
|
2015-05-17 16:27:47 +02:00
|
|
|
void CheckForUnusedVariables() const;
|
|
|
|
|
2015-06-06 09:45:56 +02:00
|
|
|
// Unused variable flags
|
|
|
|
bool WarnUnused;
|
|
|
|
bool CheckSystemVars;
|
|
|
|
bool CheckCMP0000;
|
2018-03-15 13:22:07 -04:00
|
|
|
std::set<std::string> WarnedCMP0074;
|
2015-08-25 22:19:57 +02:00
|
|
|
bool IsSourceFileTryCompile;
|
2018-11-04 22:53:44 +01:00
|
|
|
mutable bool SuppressSideEffects;
|
2000-08-29 15:26:29 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|