qmake: refactor QMakeMetaInfo::findLib() interface
move the logic for trying different extensions to MakefileGenerator::processPrlFile(), which is the only user of that functionality. that makes findLib() rather trivial and a bit of a misnomer, so rename it to checkLib(). Change-Id: If9738cc17367452853ab8d3866fa36b5d4b57213 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
eb9da60f0c
commit
caaceb30e6
@ -848,7 +848,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
encode the version number in the Project file which might be a bad
|
||||
things in days to come? --Sam
|
||||
*/
|
||||
QString lib_file = QMakeMetaInfo::findLib(Option::normalizePath((*lit) + Option::dir_sep + lib));
|
||||
QString lib_file = QMakeMetaInfo::checkLib(Option::normalizePath(
|
||||
(*lit) + Option::dir_sep + lib + Option::prl_ext));
|
||||
if (!lib_file.isEmpty()) {
|
||||
QMakeMetaInfo libinfo(project);
|
||||
if(libinfo.readLib(lib_file)) {
|
||||
|
@ -880,15 +880,19 @@ MakefileGenerator::processPrlFile(QString &file)
|
||||
{
|
||||
bool try_replace_file = false;
|
||||
QString f = fileFixify(file, FileFixifyBackwards);
|
||||
QString meta_file = QMakeMetaInfo::findLib(f);
|
||||
if (!meta_file.isEmpty()) {
|
||||
QString meta_file;
|
||||
if (f.endsWith(Option::prl_ext)) {
|
||||
meta_file = QMakeMetaInfo::checkLib(f);
|
||||
try_replace_file = true;
|
||||
} else {
|
||||
QString tmp = f;
|
||||
int ext = tmp.lastIndexOf('.');
|
||||
if(ext != -1)
|
||||
tmp = tmp.left(ext);
|
||||
meta_file = QMakeMetaInfo::findLib(tmp);
|
||||
meta_file = QMakeMetaInfo::checkLib(f + Option::prl_ext);
|
||||
if (!meta_file.isEmpty()) {
|
||||
try_replace_file = true;
|
||||
} else {
|
||||
int ext = f.lastIndexOf('.');
|
||||
if (ext != -1)
|
||||
meta_file = QMakeMetaInfo::checkLib(f.left(ext) + Option::prl_ext);
|
||||
}
|
||||
}
|
||||
if (meta_file.isEmpty())
|
||||
return false;
|
||||
|
@ -60,13 +60,9 @@ QMakeMetaInfo::readLib(const QString &meta_file)
|
||||
|
||||
|
||||
QString
|
||||
QMakeMetaInfo::findLib(const QString &lib)
|
||||
QMakeMetaInfo::checkLib(const QString &lib)
|
||||
{
|
||||
QString ret;
|
||||
if (lib.endsWith(Option::prl_ext))
|
||||
ret = QFile::exists(lib) ? lib : QString();
|
||||
else if (QFile::exists(lib + Option::prl_ext))
|
||||
ret = lib + Option::prl_ext;
|
||||
QString ret = QFile::exists(lib) ? lib : QString();
|
||||
if(ret.isNull()) {
|
||||
debug_msg(2, "QMakeMetaInfo: Cannot find info file for %s", lib.toLatin1().constData());
|
||||
} else {
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
QMakeMetaInfo(QMakeProject *_conf);
|
||||
|
||||
// These functions expect the path to be normalized
|
||||
static QString findLib(const QString &lib);
|
||||
static QString checkLib(const QString &lib);
|
||||
bool readLib(const QString &meta_file);
|
||||
|
||||
bool isEmpty(const ProKey &v);
|
||||
|
Loading…
x
Reference in New Issue
Block a user