[CMake] link_directories issue, cmake 2.8.5
Alexander Neundorf
a.neundorf-work at gmx.net
Fri Nov 25 10:38:22 EST 2011
On Friday 25 November 2011, Michael Hertling wrote:
> On 11/23/2011 05:39 PM, Vladimir Chebotarev wrote:
> > Hello.
> >
> > I've just found an issue with link_directories and cmake 2.8.5.
> > If I give an absolute but not normalized path like
> > c:/bla-bla-bla/../bla/bla as its argument (with default CMP0015),
> > cmake thinks it is relative path and shows a warning about explicitly
> > undefined policy. Also it normalizes path making it relative and
> > actually makes a mistake during that, so the final VC project can't find
> > the path to library.
>
> Take that path, use it to fully specify the library's location and
> eliminate LINK_DIRECTORIES() from your project, cf. [1]. Then, if
> things still don't work, report anew on the persisting problems.
This is on Windows, or are you crosscompiling or something ?
Strange. This is what cmLinkDirectoriesCommand.cxx does:
...
std::string unixPath = dir;
cmSystemTools::ConvertToUnixSlashes(unixPath);
if(!cmSystemTools::FileIsFullPath(unixPath.c_str()))
and the implementation of FileIsFullPath() follows. It looks like it should go
into the branch where it checks for the ':'
bool SystemTools::FileIsFullPath(const char* in_name)
{
kwsys_stl::string name = in_name;
#if defined(_WIN32) || defined(__CYGWIN__)
// On Windows, the name must be at least two characters long.
if(name.length() < 2)
{
return false;
}
if(name[1] == ':')
{
return true;
}
if(name[0] == '\\')
{
return true;
}
#else
// On UNIX, the name must be at least one character long.
if(name.length() < 1)
{
return false;
}
#endif
#if !defined(_WIN32)
if(name[0] == '~')
{
return true;
}
#endif
// On UNIX, the name must begin in a '/'.
// On Windows, if the name begins in a '/', then it is a full
// network path.
if(name[0] == '/')
{
return true;
}
return false;
}
Alex
More information about the CMake
mailing list