1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#include "meta.h"
5#include "project.h"
6#include "option.h"
7#include <qdir.h>
8
9QT_BEGIN_NAMESPACE
10
11QHash<QString, ProValueMap> QMakeMetaInfo::cache_vars;
12
13bool
14QMakeMetaInfo::readLib(const QString &meta_file)
15{
16 if(cache_vars.contains(key: meta_file)) {
17 vars = cache_vars[meta_file];
18 return true;
19 }
20
21 QMakeProject proj;
22 if (!proj.read(project: Option::normalizePath(in: meta_file), what: QMakeEvaluator::LoadProOnly))
23 return false;
24 vars = proj.variables();
25 cache_vars.insert(key: meta_file, value: vars);
26 return true;
27}
28
29
30QString
31QMakeMetaInfo::checkLib(const QString &lib)
32{
33 QString ret = QFile::exists(fileName: lib) ? lib : QString();
34 if(ret.isNull()) {
35 debug_msg(level: 2, fmt: "QMakeMetaInfo: Cannot find info file for %s", lib.toLatin1().constData());
36 } else {
37 debug_msg(level: 2, fmt: "QMakeMetaInfo: Found info file %s for %s", ret.toLatin1().constData(), lib.toLatin1().constData());
38 }
39 return ret;
40}
41
42QT_END_NAMESPACE
43

source code of qtbase/qmake/meta.cpp