summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-30 15:55:24 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-09-30 15:55:33 (GMT)
commitd91c3e33cbf9592f90f65bd7d990a8b54ad140d1 (patch)
tree5b84e72c9c2d5ca1e3098d304f8582a140f52c3d /Source/cmMakefile.h
parentf002c1cfc7f66edb9c9821524671574c23f92cd2 (diff)
parente8b0359a4318bb682c96e527de7ed7f5be02c38f (diff)
downloadCMake-d91c3e33cbf9592f90f65bd7d990a8b54ad140d1.zip
CMake-d91c3e33cbf9592f90f65bd7d990a8b54ad140d1.tar.gz
CMake-d91c3e33cbf9592f90f65bd7d990a8b54ad140d1.tar.bz2
Merge topic 'cmake_language-DEFER'
e8b0359a43 cmake_language: Add signature to DEFER calls to later times 9880549405 cmake_language: Make all errors fatal 4f33f3dcff cmake_language(CALL): Accept empty ${var} expansions 4ebe9c4ce1 cmake_language(EVAL): Factor out internal helper 78ff24a3a7 Help: Use singular placeholder name in cmake_language signature edd60d4419 Tests: Simplify RunCMake.cmake_language invalid command cases 1a5bf8245e cmMakefile: Clarify name of internal list file run method Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5262
Diffstat (limited to 'Source/cmMakefile.h')
-rw-r--r--Source/cmMakefile.h39
1 files changed, 34 insertions, 5 deletions
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 7c3348d..c7940fb 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -15,6 +15,7 @@
#include <unordered_map>
#include <vector>
+#include <cm/optional>
#include <cm/string_view>
#include "cmsys/RegularExpression.hxx"
@@ -695,7 +696,8 @@ public:
/**
* Print a command's invocation
*/
- void PrintCommandTrace(const cmListFileFunction& lff) const;
+ void PrintCommandTrace(cmListFileFunction const& lff,
+ cm::optional<std::string> const& deferId = {}) const;
/**
* Set a callback that is invoked whenever ExecuteCommand is called.
@@ -706,8 +708,8 @@ public:
* Execute a single CMake command. Returns true if the command
* succeeded or false if it failed.
*/
- bool ExecuteCommand(const cmListFileFunction& lff,
- cmExecutionStatus& status);
+ bool ExecuteCommand(const cmListFileFunction& lff, cmExecutionStatus& status,
+ cm::optional<std::string> deferId = {});
//! Enable support for named language, if nil then all languages are
/// enabled.
@@ -965,6 +967,12 @@ public:
int GetRecursionDepth() const;
void SetRecursionDepth(int recursionDepth);
+ std::string NewDeferId();
+ bool DeferCall(std::string id, std::string fileName, cmListFileFunction lff);
+ bool DeferCancelCall(std::string const& id);
+ cm::optional<std::string> DeferGetCallIds() const;
+ cm::optional<std::string> DeferGetCall(std::string const& id) const;
+
protected:
// add link libraries and directories to the target
void AddGlobalLinkInformation(cmTarget& target);
@@ -1026,10 +1034,25 @@ private:
cmListFileBacktrace Backtrace;
int RecursionDepth;
+ struct DeferCommand
+ {
+ // Id is empty for an already-executed or cancelled operation.
+ std::string Id;
+ std::string FilePath;
+ cmListFileFunction Command;
+ };
+ struct DeferCommands
+ {
+ std::vector<DeferCommand> Commands;
+ };
+ std::unique_ptr<DeferCommands> Defer;
+ bool DeferRunning = false;
+
void DoGenerate(cmLocalGenerator& lg);
- void ReadListFile(cmListFile const& listFile,
- const std::string& filenametoread);
+ void RunListFile(cmListFile const& listFile,
+ const std::string& filenametoread,
+ DeferCommands* defer = nullptr);
bool ParseDefineFlag(std::string const& definition, bool remove);
@@ -1080,6 +1103,12 @@ private:
class ListFileScope;
friend class ListFileScope;
+ class DeferScope;
+ friend class DeferScope;
+
+ class DeferCallScope;
+ friend class DeferCallScope;
+
class BuildsystemFileScope;
friend class BuildsystemFileScope;