File indexing completed on 2024-05-05 04:39:25

0001 /*
0002     SPDX-FileCopyrightText: 2006 Matt Rogers <mattr@kde.org>
0003     SPDX-FileCopyrightText: 2007 Aleix Pol <aleixpol@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #include "cmakemodelitems.h"
0009 #include "cmakeutils.h"
0010 
0011 CMakeTargetItem::CMakeTargetItem(KDevelop::ProjectBaseItem* parent, const QString& name, const KDevelop::Path &builtUrl)
0012     : KDevelop::ProjectExecutableTargetItem(parent->project(), name, parent)
0013     , m_builtUrl(builtUrl)
0014 {}
0015 
0016 QUrl CMakeTargetItem::builtUrl() const
0017 {
0018     if (!m_builtUrl.isEmpty())
0019         return m_builtUrl.toUrl();
0020 
0021     const KDevelop::Path buildDir = CMake::currentBuildDir(project());
0022     if (buildDir.isEmpty())
0023         return QUrl();
0024 
0025     QString p = project()->path().relativePath(parent()->path());
0026     return KDevelop::Path(KDevelop::Path(buildDir, p), text()).toUrl();
0027 }
0028 
0029 QUrl CMakeTargetItem::installedUrl() const
0030 {
0031     return QUrl();
0032 }