[cmake-developers] [PATCH] install: correctly deal with paths in generator expressions in DIRECTORY

Brad King brad.king at kitware.com
Tue Aug 30 10:53:54 EDT 2016


On 08/30/2016 03:58 AM, Yves Frederix wrote:
> Some time ago, I contributed generator expressions to
> install(DIRECTORY). It turns out, however, that the patch was
> incomplete and that there are problems in case the provided directory
> starts with a generator expression and evaluates to a full path. In
> attachment you can find a fix for the problem.

Thanks.

> -      if (!cmSystemTools::FileIsFullPath(dir.c_str())) {
> +      std::string::size_type gpos = cmGeneratorExpression::Find(dir);
> +      if (gpos != 0 && !cmSystemTools::FileIsFullPath(dir.c_str())) {

Good.  This check is used in several similar locations.

> +    if (!cmSystemTools::FileIsFullPath(i->c_str())) {
> +      *i = std::string(makefile.GetCurrentSourceDirectory()) + "/" + *i;

Perhaps we should issue a diagnostic here.  In principle the caller
should always provide a full path.  If they use a genex to do it then
they are on their own.

Thanks,
-Brad



More information about the cmake-developers mailing list