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())
|
||||
== Android::Constants::ANDROID_DEVICE_TYPE;
|
||||
for (const CMakeBuildTarget &ct : m_buildTargets) {
|
||||
if (ct.targetType == UtilityType)
|
||||
if (CMakeBuildSystem::filteredOutTarget(ct))
|
||||
continue;
|
||||
|
||||
if (ct.targetType == ExecutableType || (forAndroid && ct.targetType == DynamicLibraryType)) {
|
||||
@@ -1047,11 +1047,10 @@ const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
|
||||
|
||||
QStringList CMakeBuildSystem::buildTargetTitles() const
|
||||
{
|
||||
auto nonUtilityTargets = filtered(m_buildTargets, [this](const CMakeBuildTarget &target){
|
||||
return target.targetType != UtilityType ||
|
||||
CMakeBuildStep::specialTargets(usesAllCapsTargets()).contains(target.title);
|
||||
auto nonAutogenTargets = filtered(m_buildTargets, [this](const CMakeBuildTarget &target){
|
||||
return !CMakeBuildSystem::filteredOutTarget(target);
|
||||
});
|
||||
return transform(nonUtilityTargets, &CMakeBuildTarget::title);
|
||||
return transform(nonAutogenTargets, &CMakeBuildTarget::title);
|
||||
}
|
||||
|
||||
const QList<CMakeBuildTarget> &CMakeBuildSystem::buildTargets() const
|
||||
@@ -1073,6 +1072,12 @@ CMakeConfig CMakeBuildSystem::parseCMakeCacheDotTxt(const Utils::FilePath &cache
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CMakeBuildSystem::filteredOutTarget(const CMakeBuildTarget &target)
|
||||
{
|
||||
return target.title.endsWith("_autogen") ||
|
||||
target.title.endsWith("_autogen_timestamp_deps");
|
||||
}
|
||||
|
||||
bool CMakeBuildSystem::isMultiConfig() const
|
||||
{
|
||||
return m_reader.isMultiConfig();
|
||||
|
||||
@@ -99,6 +99,8 @@ public:
|
||||
static CMakeConfig parseCMakeCacheDotTxt(const Utils::FilePath &cacheFile,
|
||||
QString *errorMessage);
|
||||
|
||||
static bool filteredOutTarget(const CMakeBuildTarget &target);
|
||||
|
||||
bool isMultiConfig() const;
|
||||
bool usesAllCapsTargets() const;
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ void CMakeTargetLocatorFilter::prepareSearch(const QString &entry)
|
||||
|
||||
const QList<CMakeBuildTarget> buildTargets = bs->buildTargets();
|
||||
for (const CMakeBuildTarget &target : buildTargets) {
|
||||
if (target.targetType == UtilityType && !CMakeBuildStep::specialTargets(bs->usesAllCapsTargets()).contains(target.title))
|
||||
if (CMakeBuildSystem::filteredOutTarget(target))
|
||||
continue;
|
||||
const int index = target.title.indexOf(entry);
|
||||
if (index >= 0) {
|
||||
|
||||
Reference in New Issue
Block a user