diff options
author | Brad King <brad.king@kitware.com> | 2017-06-08 15:54:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-06-09 14:38:43 (GMT) |
commit | 82be694c7a1a878650563cd2c72b60f314d5dc85 (patch) | |
tree | 7ab8aa180d53af798fc19598874543ac2e98fd68 /Source/cmGeneratorExpressionEvaluationFile.h | |
parent | 69050f4d16ae649e074b5fd7cb3bae1811b403a8 (diff) | |
download | CMake-82be694c7a1a878650563cd2c72b60f314d5dc85.zip CMake-82be694c7a1a878650563cd2c72b60f314d5dc85.tar.gz CMake-82be694c7a1a878650563cd2c72b60f314d5dc85.tar.bz2 |
file(GENERATE): Add policy CMP0070 to define relative path behavior
Previously `file(GENERATE)` did not define any behavior for relative
paths given to the `OUTPUT` or `INPUT` arguments. Define behavior
consistent with CMake conventions and add a policy to provide
compatibility for projects that relied on the old accidental behavior.
Fixes: #16786
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluationFile.h')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluationFile.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h index 9872746..ecf919d 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.h +++ b/Source/cmGeneratorExpressionEvaluationFile.h @@ -10,6 +10,7 @@ #include <vector> #include "cmGeneratorExpression.h" +#include "cmPolicies.h" #include "cm_auto_ptr.hxx" #include "cm_sys_stat.h" @@ -21,7 +22,8 @@ public: cmGeneratorExpressionEvaluationFile( const std::string& input, CM_AUTO_PTR<cmCompiledGeneratorExpression> outputFileExpr, - CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, bool inputIsContent); + CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, bool inputIsContent, + cmPolicies::PolicyStatus policyStatusCMP0070); void Generate(cmLocalGenerator* lg); @@ -35,12 +37,21 @@ private: cmCompiledGeneratorExpression* inputExpression, std::map<std::string, std::string>& outputFiles, mode_t perm); + enum PathRole + { + PathForInput, + PathForOutput + }; + std::string FixRelativePath(std::string const& filePath, PathRole role, + cmLocalGenerator* lg); + private: const std::string Input; const CM_AUTO_PTR<cmCompiledGeneratorExpression> OutputFileExpr; const CM_AUTO_PTR<cmCompiledGeneratorExpression> Condition; std::vector<std::string> Files; const bool InputIsContent; + cmPolicies::PolicyStatus PolicyStatusCMP0070; }; #endif |