summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-07-25 07:05:03 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-07-25 12:31:22 (GMT)
commitd777b8e7167e0c1a3de4ebcf66fac5fc604f1dd9 (patch)
tree87801670e241b12f64697f02c974b72458f90670 /Source
parent650e61f833c2cc3ace8405a22eb80a10cfc6187c (diff)
downloadCMake-d777b8e7167e0c1a3de4ebcf66fac5fc604f1dd9.zip
CMake-d777b8e7167e0c1a3de4ebcf66fac5fc604f1dd9.tar.gz
CMake-d777b8e7167e0c1a3de4ebcf66fac5fc604f1dd9.tar.bz2
Genex: Allow relative paths in INSTALL_INTERFACE.
These paths can be prepended with the ${_IMPORT_PREFIX} generated in the export file. Such relative paths were previously an error.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmExportFileGenerator.cxx3
-rw-r--r--Source/cmGeneratorExpression.cxx36
-rw-r--r--Source/cmGeneratorExpression.h3
3 files changed, 36 insertions, 6 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index cff539f..b8188a6 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -302,7 +302,8 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
const char* sep = input ? ";" : "";
includes += sep + tei->InterfaceIncludeDirectories;
std::string prepro = cmGeneratorExpression::Preprocess(includes,
- preprocessRule);
+ preprocessRule,
+ true);
if (!prepro.empty())
{
this->ResolveTargetsInGeneratorExpressions(prepro, target,
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index ab8bd13..e962313 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -229,8 +229,27 @@ static std::string stripAllGeneratorExpressions(const std::string &input)
}
//----------------------------------------------------------------------------
+static void prefixItems(const std::string &content, std::string &result,
+ const std::string &prefix)
+{
+ std::vector<std::string> entries;
+ cmGeneratorExpression::Split(content, entries);
+ for(std::vector<std::string>::const_iterator ei = entries.begin();
+ ei != entries.end(); ++ei)
+ {
+ if (!cmSystemTools::FileIsFullPath(ei->c_str())
+ && cmGeneratorExpression::Find(*ei) == std::string::npos)
+ {
+ result += prefix;
+ }
+ result += *ei;
+ }
+}
+
+//----------------------------------------------------------------------------
static std::string stripExportInterface(const std::string &input,
- cmGeneratorExpression::PreprocessContext context)
+ cmGeneratorExpression::PreprocessContext context,
+ bool resolveRelative)
{
std::string result;
@@ -289,7 +308,15 @@ static std::string stripExportInterface(const std::string &input,
else if(context == cmGeneratorExpression::InstallInterface
&& gotInstallInterface)
{
- result += input.substr(pos, c - cStart);
+ const std::string content = input.substr(pos, c - cStart);
+ if (resolveRelative)
+ {
+ prefixItems(content, result, "${_IMPORT_PREFIX}/");
+ }
+ else
+ {
+ result += content;
+ }
}
break;
}
@@ -380,7 +407,8 @@ void cmGeneratorExpression::Split(const std::string &input,
//----------------------------------------------------------------------------
std::string cmGeneratorExpression::Preprocess(const std::string &input,
- PreprocessContext context)
+ PreprocessContext context,
+ bool resolveRelative)
{
if (context == StripAllGeneratorExpressions)
{
@@ -388,7 +416,7 @@ std::string cmGeneratorExpression::Preprocess(const std::string &input,
}
else if (context == BuildInterface || context == InstallInterface)
{
- return stripExportInterface(input, context);
+ return stripExportInterface(input, context, resolveRelative);
}
assert(!"cmGeneratorExpression::Preprocess called with invalid args");
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 86b6f25..c20f130 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -57,7 +57,8 @@ public:
};
static std::string Preprocess(const std::string &input,
- PreprocessContext context);
+ PreprocessContext context,
+ bool resolveRelative = false);
static void Split(const std::string &input,
std::vector<std::string> &output);