cmLocalVisualStudio7Generator: Make vfproj conditions more explicit

Avoid relying on the conditions for `vcproj` used by the VS9 generator.
This commit is contained in:
Brad King
2024-05-06 14:55:10 -04:00
parent acc5ea7390
commit 0bdcf1cb17
4 changed files with 20 additions and 16 deletions
-8
View File
@@ -196,13 +196,6 @@ void cmLocalVisualStudio7Generator::GenerateTarget(cmGeneratorTarget* target)
this->FortranProject = gg->TargetIsFortranOnly(target); this->FortranProject = gg->TargetIsFortranOnly(target);
this->WindowsCEProject = gg->TargetsWindowsCE(); 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 // add to the list of projects
target->Target->SetProperty("GENERATOR_FILE_NAME", lname); target->Target->SetProperty("GENERATOR_FILE_NAME", lname);
// create the dsp.cmake file // create the dsp.cmake file
@@ -226,7 +219,6 @@ void cmLocalVisualStudio7Generator::GenerateTarget(cmGeneratorTarget* target)
this->WindowsCEProject = false; this->WindowsCEProject = false;
this->FortranProject = false; this->FortranProject = false;
gg->SetVersion(realVersion);
} }
cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
+2
View File
@@ -91,6 +91,8 @@ public:
return this->SourcesVisited[target]; return this->SourcesVisited[target];
}; };
bool IsVFProj() const override { return this->FortranProject; }
protected: protected:
virtual void GenerateTarget(cmGeneratorTarget* target); virtual void GenerateTarget(cmGeneratorTarget* target);
+2
View File
@@ -31,6 +31,8 @@ public:
cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmMakefile* mf); cmLocalVisualStudioGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
~cmLocalVisualStudioGenerator() override; ~cmLocalVisualStudioGenerator() override;
virtual bool IsVFProj() const = 0;
std::string ConstructScript(cmCustomCommandGenerator const& ccg, std::string ConstructScript(cmCustomCommandGenerator const& ccg,
const std::string& newline = "\n"); const std::string& newline = "\n");
std::string FinishConstructScript(VsProjectType projectType, std::string FinishConstructScript(VsProjectType projectType,
+16 -8
View File
@@ -75,7 +75,8 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault()
// initialization to off, but the user has the option of removing // initialization to off, but the user has the option of removing
// the flag to disable exception handling. When the user does // the flag to disable exception handling. When the user does
// remove the flag we need to override the IDE default of on. // 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 // by default VS puts <ExceptionHandling></ExceptionHandling> empty
// for a project, to make our projects look the same put a new line // for a project, to make our projects look the same put a new line
// and space over for the closing </ExceptionHandling> as the default // and space over for the closing </ExceptionHandling> as the default
@@ -98,8 +99,10 @@ void cmVisualStudioGeneratorOptions::SetVerboseMakefile(bool verbose)
if (verbose && if (verbose &&
this->FlagMap.find("SuppressStartupBanner") == this->FlagMap.end()) { this->FlagMap.find("SuppressStartupBanner") == this->FlagMap.end()) {
this->FlagMap["SuppressStartupBanner"] = this->FlagMap["SuppressStartupBanner"] =
this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 ? "" this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 &&
: "FALSE"; !this->LocalGenerator->IsVFProj()
? ""
: "FALSE";
} }
} }
@@ -366,13 +369,15 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions(
} }
std::ostringstream oss; std::ostringstream oss;
if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) { if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 &&
!this->LocalGenerator->IsVFProj()) {
oss << "%(" << tag << ')'; oss << "%(" << tag << ')';
} }
auto de = cmRemoveDuplicates(this->Defines); auto de = cmRemoveDuplicates(this->Defines);
for (std::string const& di : cmMakeRange(this->Defines.cbegin(), de)) { for (std::string const& di : cmMakeRange(this->Defines.cbegin(), de)) {
std::string define; std::string define;
if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) { if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 &&
!this->LocalGenerator->IsVFProj()) {
// Escape the definition for MSBuild. // Escape the definition for MSBuild.
define = di; define = di;
cmVS10EscapeForMSBuild(define); cmVS10EscapeForMSBuild(define);
@@ -419,7 +424,8 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories(
} }
// Escape this include for the MSBuild. // Escape this include for the MSBuild.
if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) { if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 &&
!this->LocalGenerator->IsVFProj()) {
cmVS10EscapeForMSBuild(include); cmVS10EscapeForMSBuild(include);
} }
oss << sep << include; oss << sep << include;
@@ -431,7 +437,8 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories(
} }
} }
if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) { if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 &&
!this->LocalGenerator->IsVFProj()) {
oss << sep << "%(" << tag << ')'; oss << sep << "%(" << tag << ')';
} }
@@ -445,7 +452,8 @@ void cmVisualStudioGeneratorOptions::OutputFlagMap(std::ostream& fout,
std::ostringstream oss; std::ostringstream oss;
const char* sep = ""; const char* sep = "";
for (std::string i : m.second) { for (std::string i : m.second) {
if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) { if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 &&
!this->LocalGenerator->IsVFProj()) {
cmVS10EscapeForMSBuild(i); cmVS10EscapeForMSBuild(i);
} }
oss << sep << i; oss << sep << i;