diff options
author | Brad King <brad.king@kitware.com> | 2023-11-22 15:03:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-11-22 15:22:12 (GMT) |
commit | 43d218d970665245692b8f8a1163a42ee9ee186d (patch) | |
tree | b7386d5395f13c424b630060a40d36233cea7cea /Source/cmGlobalVisualStudio10Generator.cxx | |
parent | 5c77facd7826f285fbf4d553160d1a542d60942b (diff) | |
download | CMake-43d218d970665245692b8f8a1163a42ee9ee186d.zip CMake-43d218d970665245692b8f8a1163a42ee9ee186d.tar.gz CMake-43d218d970665245692b8f8a1163a42ee9ee186d.tar.bz2 |
VS: Add support for using Intel oneAPI Fortran compiler in .vfproj files
Add a `fortran={ifort,ifx}` field to `CMAKE_GENERATOR_TOOLSET` to
specify which Intel Fortran compiler to use.
Fixes: #25427
Diffstat (limited to 'Source/cmGlobalVisualStudio10Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 541db63..c93b140 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -191,6 +191,23 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( } } + if (this->GeneratorToolsetFortran) { + if (*this->GeneratorToolsetFortran != "ifx" && + *this->GeneratorToolsetFortran != "ifort") { + mf->IssueMessage(MessageType::FATAL_ERROR, + cmStrCat("Generator\n" + " ", + this->GetName(), + "\n" + "given toolset\n" + " fortran=", + *this->GeneratorToolsetFortran, + "\n" + "but the value is not \"ifx\" or \"ifort\".")); + this->GeneratorToolsetFortran = cm::nullopt; + } + } + if (!this->GeneratorToolsetVersion.empty() && this->GeneratorToolsetVersion != "Test Toolset Version"_s) { // If a specific minor version of the MSVC toolset is requested, verify @@ -300,6 +317,9 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( if (const char* cudaDir = this->GetPlatformToolsetCudaCustomDir()) { mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR", cudaDir); } + if (cm::optional<std::string> fortran = this->GetPlatformToolsetFortran()) { + mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_FORTRAN", *fortran); + } if (const char* vcTargetsDir = this->GetCustomVCTargetsPath()) { mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR", vcTargetsDir); @@ -410,6 +430,10 @@ bool cmGlobalVisualStudio10Generator::ProcessGeneratorToolsetField( cmSystemTools::ConvertToUnixSlashes(this->CustomFlagTableDir); return true; } + if (key == "fortran"_s) { + this->GeneratorToolsetFortran = value; + return true; + } if (key == "version"_s) { this->GeneratorToolsetVersion = value; return true; |