summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-29 14:19:31 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-01-29 14:19:39 (GMT)
commit9620cb935a49e7b4955f5b1d0ffa2e93b4327591 (patch)
treed0e011b3649793502929e4e0597b6d636fdc57ec /Source/cmGlobalGenerator.h
parent60c06620a690f0cbeeaa3fba762e19cd031669ca (diff)
parent66801f4d40227c46904ad54848bd1da959604cbf (diff)
downloadCMake-9620cb935a49e7b4955f5b1d0ffa2e93b4327591.zip
CMake-9620cb935a49e7b4955f5b1d0ffa2e93b4327591.tar.gz
CMake-9620cb935a49e7b4955f5b1d0ffa2e93b4327591.tar.bz2
Merge topic 'add_consistent_verbose_build_flag'
66801f4d40 cmake: Add tests for verbose output to --build mode 439fe2e253 cmake: Add options for verbose output to --build mode 638667efa2 cmake: cmcmd.cxx fix "The arguments are" comments 3ca4402966 ctest: Fix --build-and-test without --build-target on Xcode cb6c233ecc cmake: Add -hideShellScriptEnvironment xcodebuild option 1a45266cb5 cmGlobalGenerator: Add a class that represent the build command Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2708
Diffstat (limited to 'Source/cmGlobalGenerator.h')
-rw-r--r--Source/cmGlobalGenerator.h54
1 files changed, 53 insertions, 1 deletions
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 84ec7a9..ce6bdbf 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -41,6 +41,54 @@ class cmSourceFile;
class cmStateDirectory;
class cmake;
+namespace detail {
+inline void AppendStrs(std::vector<std::string>&)
+{
+}
+template <typename T, typename... Ts>
+inline void AppendStrs(std::vector<std::string>& command, T&& s, Ts&&... ts)
+{
+ command.emplace_back(std::forward<T>(s));
+ AppendStrs(command, std::forward<Ts>(ts)...);
+}
+
+struct GeneratedMakeCommand
+{
+ // Add each argument as a separate element to the vector
+ template <typename... T>
+ void add(T&&... args)
+ {
+ // iterate the args and append each one
+ AppendStrs(PrimaryCommand, std::forward<T>(args)...);
+ }
+
+ // Add each value in the iterators as a separate element to the vector
+ void add(std::vector<std::string>::const_iterator start,
+ std::vector<std::string>::const_iterator end)
+ {
+ PrimaryCommand.insert(PrimaryCommand.end(), start, end);
+ }
+
+ std::string printable() const
+ {
+ std::size_t size = PrimaryCommand.size();
+ for (auto&& i : PrimaryCommand) {
+ size += i.size();
+ }
+ std::string buffer;
+ buffer.reserve(size);
+ for (auto&& i : PrimaryCommand) {
+ buffer.append(i);
+ buffer.append(1, ' ');
+ }
+ return buffer;
+ }
+
+ std::vector<std::string> PrimaryCommand;
+ bool RequiresOutputForward = false;
+};
+}
+
/** \class cmGlobalGenerator
* \brief Responsible for overseeing the generation process for the entire tree
*
@@ -182,8 +230,12 @@ public:
virtual bool Open(const std::string& bindir, const std::string& projectName,
bool dryRun);
+ struct GeneratedMakeCommand final : public detail::GeneratedMakeCommand
+ {
+ };
+
virtual void GenerateBuildCommand(
- std::vector<std::string>& makeCommand, const std::string& makeProgram,
+ GeneratedMakeCommand& makeCommand, const std::string& makeProgram,
const std::string& projectName, const std::string& projectDir,
const std::string& targetName, const std::string& config, bool fast,
int jobs, bool verbose,