diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2018-07-09 19:15:42 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2018-07-16 15:44:23 +0000 |
commit | caaceb30e6d998939f13eb6caccef6dbd49b9558 (patch) | |
tree | 5f7a31c3d80440fbf827532fb0c7e37eedb30518 /qmake | |
parent | eb9da60f0c87cb4a3b2b26a66888c0f95cdfa6b4 (diff) |
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>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/mac/pbuilder_pbx.cpp | 3 | ||||
-rw-r--r-- | qmake/generators/makefile.cpp | 18 | ||||
-rw-r--r-- | qmake/meta.cpp | 8 | ||||
-rw-r--r-- | qmake/meta.h | 2 |
4 files changed, 16 insertions, 15 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 80891e682f..c18ed80df4 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -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)) { diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 035493b9ce..e7b7a7a10e 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -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; diff --git a/qmake/meta.cpp b/qmake/meta.cpp index a3e5024137..2e8759b8ba 100644 --- a/qmake/meta.cpp +++ b/qmake/meta.cpp @@ -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 { diff --git a/qmake/meta.h b/qmake/meta.h index b2a0f40054..4721085fd2 100644 --- a/qmake/meta.h +++ b/qmake/meta.h @@ -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); |