forked from qt-creator/qt-creator
CMakePM: Do not filter out all UTILITY targets
add_custom_target will be set as UTILITY target, which one might want to reference as "cm <target>" or "--target <target>". Filter out instead the "_autogen" and "_autogen_timestamp_deps". Fixes: QTCREATORBUG-25726 Change-Id: Ia73d6e87e4b230114d068649964792ff3f626378 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -1016,7 +1016,7 @@ const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
|
|||||||
const bool forAndroid = DeviceTypeKitAspect::deviceTypeId(kit())
|
const bool forAndroid = DeviceTypeKitAspect::deviceTypeId(kit())
|
||||||
== Android::Constants::ANDROID_DEVICE_TYPE;
|
== Android::Constants::ANDROID_DEVICE_TYPE;
|
||||||
for (const CMakeBuildTarget &ct : m_buildTargets) {
|
for (const CMakeBuildTarget &ct : m_buildTargets) {
|
||||||
if (ct.targetType == UtilityType)
|
if (CMakeBuildSystem::filteredOutTarget(ct))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ct.targetType == ExecutableType || (forAndroid && ct.targetType == DynamicLibraryType)) {
|
if (ct.targetType == ExecutableType || (forAndroid && ct.targetType == DynamicLibraryType)) {
|
||||||
@@ -1047,11 +1047,10 @@ const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
|
|||||||
|
|
||||||
QStringList CMakeBuildSystem::buildTargetTitles() const
|
QStringList CMakeBuildSystem::buildTargetTitles() const
|
||||||
{
|
{
|
||||||
auto nonUtilityTargets = filtered(m_buildTargets, [this](const CMakeBuildTarget &target){
|
auto nonAutogenTargets = filtered(m_buildTargets, [this](const CMakeBuildTarget &target){
|
||||||
return target.targetType != UtilityType ||
|
return !CMakeBuildSystem::filteredOutTarget(target);
|
||||||
CMakeBuildStep::specialTargets(usesAllCapsTargets()).contains(target.title);
|
|
||||||
});
|
});
|
||||||
return transform(nonUtilityTargets, &CMakeBuildTarget::title);
|
return transform(nonAutogenTargets, &CMakeBuildTarget::title);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<CMakeBuildTarget> &CMakeBuildSystem::buildTargets() const
|
const QList<CMakeBuildTarget> &CMakeBuildSystem::buildTargets() const
|
||||||
@@ -1073,6 +1072,12 @@ CMakeConfig CMakeBuildSystem::parseCMakeCacheDotTxt(const Utils::FilePath &cache
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CMakeBuildSystem::filteredOutTarget(const CMakeBuildTarget &target)
|
||||||
|
{
|
||||||
|
return target.title.endsWith("_autogen") ||
|
||||||
|
target.title.endsWith("_autogen_timestamp_deps");
|
||||||
|
}
|
||||||
|
|
||||||
bool CMakeBuildSystem::isMultiConfig() const
|
bool CMakeBuildSystem::isMultiConfig() const
|
||||||
{
|
{
|
||||||
return m_reader.isMultiConfig();
|
return m_reader.isMultiConfig();
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ public:
|
|||||||
static CMakeConfig parseCMakeCacheDotTxt(const Utils::FilePath &cacheFile,
|
static CMakeConfig parseCMakeCacheDotTxt(const Utils::FilePath &cacheFile,
|
||||||
QString *errorMessage);
|
QString *errorMessage);
|
||||||
|
|
||||||
|
static bool filteredOutTarget(const CMakeBuildTarget &target);
|
||||||
|
|
||||||
bool isMultiConfig() const;
|
bool isMultiConfig() const;
|
||||||
bool usesAllCapsTargets() const;
|
bool usesAllCapsTargets() const;
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ void CMakeTargetLocatorFilter::prepareSearch(const QString &entry)
|
|||||||
|
|
||||||
const QList<CMakeBuildTarget> buildTargets = bs->buildTargets();
|
const QList<CMakeBuildTarget> buildTargets = bs->buildTargets();
|
||||||
for (const CMakeBuildTarget &target : buildTargets) {
|
for (const CMakeBuildTarget &target : buildTargets) {
|
||||||
if (target.targetType == UtilityType && !CMakeBuildStep::specialTargets(bs->usesAllCapsTargets()).contains(target.title))
|
if (CMakeBuildSystem::filteredOutTarget(target))
|
||||||
continue;
|
continue;
|
||||||
const int index = target.title.indexOf(entry);
|
const int index = target.title.indexOf(entry);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user