mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-22 06:59:01 -06:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user