Fix generated pkg-config files when cross-compiling

The Libs: line of the pkg-config files is constructed
by taking the name of the .pc file itself, and stripping
off the path and extension.  However, the code which does
this does not handle path separators correctly when the
target OS and local OS are different.  To get around this,
the custom string manipulation was replaced with a call
to QFileInfo::completeBaseName(), which can handle the
different path separators correctly.

Task-number: QTBUG-29700
Change-Id: Ia817b415d303b249f56fcc3d1f073cae99c43046
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
Matt Fischer 2013-02-18 11:29:45 -06:00 committed by The Qt Project
parent 7508719830
commit fcef9b4252

View File

@ -3158,11 +3158,8 @@ MakefileGenerator::pkgConfigFixPath(QString path) const
void
MakefileGenerator::writePkgConfigFile()
{
QString fname = pkgConfigFileName(), lname = fname;
QString fname = pkgConfigFileName();
mkdir(fileInfo(fname).path());
int slsh = lname.lastIndexOf(Option::dir_sep);
if(slsh != -1)
lname = lname.right(lname.length() - slsh - 1);
QFile ft(fname);
if(!ft.open(QIODevice::WriteOnly))
return;
@ -3249,7 +3246,7 @@ MakefileGenerator::writePkgConfigFile()
pkgConfiglibName = "-framework " + bundle + " ";
} else {
pkgConfiglibDir = "-L${libdir}";
pkgConfiglibName = "-l" + lname.left(lname.length()-Option::libtool_ext.length());
pkgConfiglibName = "-l" + fileInfo(fname).completeBaseName();
if (project->isActiveConfig("shared"))
pkgConfiglibName += project->first("TARGET_VERSION_EXT").toQString();
}