Merge topic 'install-directory-genex-fix'

3bd55dba install: Fix evaluation of leading generator expressions in DIRECTORY
This commit is contained in:
Brad King 2016-09-01 10:39:19 -04:00 committed by CMake Topic Stage
commit 06b7789d4d
2 changed files with 13 additions and 1 deletions

View File

@ -976,7 +976,8 @@ bool cmInstallCommand::HandleDirectoryMode(
} else if (doing == DoingDirs) { } else if (doing == DoingDirs) {
// Convert this directory to a full path. // Convert this directory to a full path.
std::string dir = args[i]; std::string dir = args[i];
if (!cmSystemTools::FileIsFullPath(dir.c_str())) { std::string::size_type gpos = cmGeneratorExpression::Find(dir);
if (gpos != 0 && !cmSystemTools::FileIsFullPath(dir.c_str())) {
dir = this->Makefile->GetCurrentSourceDirectory(); dir = this->Makefile->GetCurrentSourceDirectory();
dir += "/"; dir += "/";
dir += args[i]; dir += args[i];

View File

@ -13,6 +13,7 @@
#include "cmGeneratorExpression.h" #include "cmGeneratorExpression.h"
#include "cmLocalGenerator.h" #include "cmLocalGenerator.h"
#include "cmMakefile.h"
cmInstallDirectoryGenerator::cmInstallDirectoryGenerator( cmInstallDirectoryGenerator::cmInstallDirectoryGenerator(
std::vector<std::string> const& dirs, const char* dest, std::vector<std::string> const& dirs, const char* dest,
@ -73,6 +74,16 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig(
cmSystemTools::ExpandListArgument( cmSystemTools::ExpandListArgument(
cge->Evaluate(this->LocalGenerator, config), dirs); cge->Evaluate(this->LocalGenerator, config), dirs);
} }
// Make sure all dirs have absolute paths.
cmMakefile const& mf = *this->LocalGenerator->GetMakefile();
for (std::vector<std::string>::iterator i = dirs.begin(); i != dirs.end();
++i) {
if (!cmSystemTools::FileIsFullPath(i->c_str())) {
*i = std::string(mf.GetCurrentSourceDirectory()) + "/" + *i;
}
}
this->AddDirectoryInstallRule(os, config, indent, dirs); this->AddDirectoryInstallRule(os, config, indent, dirs);
} }