cmLocalVisualStudio7Generator: Make vfproj conditions more explicit
Avoid relying on the conditions for `vcproj` used by the VS9 generator.
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index e776d86..e52539e 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -196,13 +196,6 @@
this->FortranProject = gg->TargetIsFortranOnly(target);
this->WindowsCEProject = gg->TargetsWindowsCE();
- // Intel Fortran always uses VS9 format ".vfproj" files.
- cmGlobalVisualStudioGenerator::VSVersion realVersion = gg->GetVersion();
- if (this->FortranProject &&
- gg->GetVersion() >= cmGlobalVisualStudioGenerator::VSVersion::VS12) {
- gg->SetVersion(cmGlobalVisualStudioGenerator::VSVersion::VS9);
- }
-
// add to the list of projects
target->Target->SetProperty("GENERATOR_FILE_NAME", lname);
// create the dsp.cmake file
@@ -226,7 +219,6 @@
this->WindowsCEProject = false;
this->FortranProject = false;
- gg->SetVersion(realVersion);
}
cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 5be0a2b..bb05226 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -91,6 +91,8 @@
return this->SourcesVisited[target];
};
+ bool IsVFProj() const override { return this->FortranProject; }
+
protected:
virtual void GenerateTarget(cmGeneratorTarget* target);
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 8fed1bd..3e1eb5f 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -31,6 +31,8 @@
cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
~cmLocalVisualStudioGenerator() override;
+ virtual bool IsVFProj() const = 0;
+
std::string ConstructScript(cmCustomCommandGenerator const& ccg,
const std::string& newline = "\n");
std::string FinishConstructScript(VsProjectType projectType,
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 92e5893..cb08b21 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -75,7 +75,8 @@
// initialization to off, but the user has the option of removing
// the flag to disable exception handling. When the user does
// remove the flag we need to override the IDE default of on.
- if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) {
+ if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 &&
+ !this->LocalGenerator->IsVFProj()) {
// by default VS puts <ExceptionHandling></ExceptionHandling> empty
// for a project, to make our projects look the same put a new line
// and space over for the closing </ExceptionHandling> as the default
@@ -98,8 +99,10 @@
if (verbose &&
this->FlagMap.find("SuppressStartupBanner") == this->FlagMap.end()) {
this->FlagMap["SuppressStartupBanner"] =
- this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 ? ""
- : "FALSE";
+ this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 &&
+ !this->LocalGenerator->IsVFProj()
+ ? ""
+ : "FALSE";
}
}
@@ -366,13 +369,15 @@
}
std::ostringstream oss;
- if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) {
+ if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 &&
+ !this->LocalGenerator->IsVFProj()) {
oss << "%(" << tag << ')';
}
auto de = cmRemoveDuplicates(this->Defines);
for (std::string const& di : cmMakeRange(this->Defines.cbegin(), de)) {
std::string define;
- if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) {
+ if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 &&
+ !this->LocalGenerator->IsVFProj()) {
// Escape the definition for MSBuild.
define = di;
cmVS10EscapeForMSBuild(define);
@@ -419,7 +424,8 @@
}
// Escape this include for the MSBuild.
- if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) {
+ if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 &&
+ !this->LocalGenerator->IsVFProj()) {
cmVS10EscapeForMSBuild(include);
}
oss << sep << include;
@@ -431,7 +437,8 @@
}
}
- if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) {
+ if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 &&
+ !this->LocalGenerator->IsVFProj()) {
oss << sep << "%(" << tag << ')';
}
@@ -445,7 +452,8 @@
std::ostringstream oss;
const char* sep = "";
for (std::string i : m.second) {
- if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) {
+ if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 &&
+ !this->LocalGenerator->IsVFProj()) {
cmVS10EscapeForMSBuild(i);
}
oss << sep << i;