mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
VS: Introduce IsInSolution to check whether a target is in sln file
Previously, different versions of VS Generators checked whether a target was in .sln file or not by checking whether the target was to be written to build system or not. As we move `ZERO_CHECK.vcxproj` to `.proj`, we want to exclude those files from being written to `.sln` files too. This commit introduces `IsInSolution()` at `cmGlobalVisualStudioGenerator` level which can be customized at specific versioned Generator when needed.
This commit is contained in:
committed by
Brad King
parent
0682cd3657
commit
11b8366e55
@@ -359,7 +359,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
|
||||
// loop over again and write out configurations for each target
|
||||
// in the solution
|
||||
for (cmGeneratorTarget const* target : projectTargets) {
|
||||
if (!target->IsInBuildSystem()) {
|
||||
if (!this->IsInSolution(target)) {
|
||||
continue;
|
||||
}
|
||||
cmValue expath = target->GetProperty("EXTERNAL_MSPROJECT");
|
||||
@@ -396,7 +396,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
|
||||
VisualStudioFolders.clear();
|
||||
|
||||
for (cmGeneratorTarget const* target : projectTargets) {
|
||||
if (!target->IsInBuildSystem()) {
|
||||
if (!this->IsInSolution(target)) {
|
||||
continue;
|
||||
}
|
||||
bool written = false;
|
||||
|
||||
@@ -392,7 +392,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectDepends(
|
||||
TargetDependSet const& unordered = this->GetTargetDirectDepends(gt);
|
||||
OrderedTargetDependSet depends(unordered, std::string());
|
||||
for (cmTargetDepend const& i : depends) {
|
||||
if (!i->IsInBuildSystem()) {
|
||||
if (!this->IsInSolution(i)) {
|
||||
continue;
|
||||
}
|
||||
std::string guid = this->GetGUID(i->GetName());
|
||||
|
||||
@@ -837,6 +837,12 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(
|
||||
return languages.size() == 1 && *languages.begin() == "Fortran";
|
||||
}
|
||||
|
||||
bool cmGlobalVisualStudioGenerator::IsInSolution(
|
||||
const cmGeneratorTarget* gt) const
|
||||
{
|
||||
return gt->IsInBuildSystem();
|
||||
}
|
||||
|
||||
bool cmGlobalVisualStudioGenerator::TargetCompare::operator()(
|
||||
cmGeneratorTarget const* l, cmGeneratorTarget const* r) const
|
||||
{
|
||||
|
||||
@@ -98,6 +98,9 @@ public:
|
||||
// return true if target is fortran only
|
||||
bool TargetIsFortranOnly(const cmGeneratorTarget* gt);
|
||||
|
||||
// return true if target should be included in solution.
|
||||
virtual bool IsInSolution(const cmGeneratorTarget* gt) const;
|
||||
|
||||
/** Get the top-level registry key for this VS version. */
|
||||
std::string GetRegistryBase();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user