diff options
author | Brad King <brad.king@kitware.com> | 2024-05-06 18:55:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-05-08 14:37:25 (GMT) |
commit | 0bdcf1cb1789627df55af523f35ac9015715b5f0 (patch) | |
tree | ba1b13a394415a04c376016b4ea7efae05de04b1 | |
parent | acc5ea7390c53e33a9ba5f0d43989e32bc1a3c38 (diff) | |
download | CMake-0bdcf1cb1789627df55af523f35ac9015715b5f0.zip CMake-0bdcf1cb1789627df55af523f35ac9015715b5f0.tar.gz CMake-0bdcf1cb1789627df55af523f35ac9015715b5f0.tar.bz2 |
cmLocalVisualStudio7Generator: Make vfproj conditions more explicit
Avoid relying on the conditions for `vcproj` used by the VS9 generator.
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 8 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.h | 2 | ||||
-rw-r--r-- | Source/cmLocalVisualStudioGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmVisualStudioGeneratorOptions.cxx | 24 |
4 files changed, 20 insertions, 16 deletions
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 @@ 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 5be0a2b..bb05226 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 8fed1bd..3e1eb5f 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 92e5893..cb08b21 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 <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 @@ 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; |