summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionEvaluationFile.h
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-01-02 16:10:04 (GMT)
committerBrad King <brad.king@kitware.com>2013-05-24 13:02:45 (GMT)
commitb983a58bdf1a03a49f2512ac68390888669ac30b (patch)
treefdef14cc2d264b50e8bb48fbe53e2858852400de /Source/cmGeneratorExpressionEvaluationFile.h
parent272431a84ff13eb17cf04389428f57c7fe13e3a2 (diff)
downloadCMake-b983a58bdf1a03a49f2512ac68390888669ac30b.zip
CMake-b983a58bdf1a03a49f2512ac68390888669ac30b.tar.gz
CMake-b983a58bdf1a03a49f2512ac68390888669ac30b.tar.bz2
file: Add GENERATE command to produce files at generate time
The idea is to write to a temp file which contains generator expressions, and at generate time, evaluate the generator expressions, and write the result to a file. Because executables on Windows are limited in the length of command line it is possible to use, it is common to write command line arguments to a file instead and specify the file as a source of arguments. This new FILE(GENERATE) subcommand allows the use of generator expressions to create such files so that they can be used with add_custom_command for example.
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluationFile.h')
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h
new file mode 100644
index 0000000..20ee5cb
--- /dev/null
+++ b/Source/cmGeneratorExpressionEvaluationFile.h
@@ -0,0 +1,48 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2013 Stephen Kelly <steveire@gmail.com>
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmGeneratorExpressionEvaluationFile_h
+#define cmGeneratorExpressionEvaluationFile_h
+
+#include "cmStandardIncludes.h"
+#include <cmsys/auto_ptr.hxx>
+
+#include "cmGeneratorExpression.h"
+
+//----------------------------------------------------------------------------
+class cmGeneratorExpressionEvaluationFile
+{
+public:
+ cmGeneratorExpressionEvaluationFile(const std::string &input,
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> outputFileExpr,
+ cmMakefile *makefile,
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
+ bool inputIsContent);
+
+ void Generate();
+
+ std::vector<std::string> GetFiles() const { return this->Files; }
+
+private:
+ void Generate(const char *config,
+ cmCompiledGeneratorExpression* inputExpression,
+ std::map<std::string, std::string> &outputFiles);
+
+private:
+ const std::string Input;
+ const cmsys::auto_ptr<cmCompiledGeneratorExpression> OutputFileExpr;
+ cmMakefile *Makefile;
+ const cmsys::auto_ptr<cmCompiledGeneratorExpression> Condition;
+ std::vector<std::string> Files;
+ const bool InputIsContent;
+};
+
+#endif