diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index e776d86350..e52539e806 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -196,13 +196,6 @@ void cmLocalVisualStudio7Generator::GenerateTarget(cmGeneratorTarget* target) 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 @@ void cmLocalVisualStudio7Generator::GenerateTarget(cmGeneratorTarget* target) this->WindowsCEProject = false; this->FortranProject = false; - gg->SetVersion(realVersion); } cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 5be0a2b079..bb05226b08 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -91,6 +91,8 @@ public: 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 8fed1bd87f..3e1eb5f596 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -31,6 +31,8 @@ public: 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 92e5893ce1..cb08b217fc 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -75,7 +75,8 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() // 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 empty // for a project, to make our projects look the same put a new line // and space over for the closing as the default @@ -98,8 +99,10 @@ void cmVisualStudioGeneratorOptions::SetVerboseMakefile(bool verbose) 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 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions( } 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 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories( } // 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 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories( } } - if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) { + if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9 && + !this->LocalGenerator->IsVFProj()) { oss << sep << "%(" << tag << ')'; } @@ -445,7 +452,8 @@ void cmVisualStudioGeneratorOptions::OutputFlagMap(std::ostream& fout, 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;