VS: Detect Intel Fortran compiler id and version

Teach CMakeDetermineCompilerId to use a .vfproj project file to
build the Fortran compiler id source file under the Visual Studio
generators.
This commit is contained in:
Brad King 2013-10-11 13:40:43 -04:00
parent b8522a8c8a
commit af40e8c312
4 changed files with 47 additions and 6 deletions

View File

@ -114,7 +114,11 @@ Id flags: ${testflags}
set(id_platform ${CMAKE_VS_PLATFORM_NAME}) set(id_platform ${CMAKE_VS_PLATFORM_NAME})
set(id_lang "${lang}") set(id_lang "${lang}")
set(id_cl cl.exe) set(id_cl cl.exe)
if(NOT "${vs_version}" VERSION_LESS 10) if(lang STREQUAL Fortran)
set(v Intel)
set(ext vfproj)
set(id_cl ifort.exe)
elseif(NOT "${vs_version}" VERSION_LESS 10)
set(v 10) set(v 10)
set(ext vcxproj) set(ext vcxproj)
elseif(NOT "${vs_version}" VERSION_LESS 7) elseif(NOT "${vs_version}" VERSION_LESS 7)

View File

@ -26,10 +26,6 @@ if(NOT CMAKE_Fortran_COMPILER_NAMES)
endif() endif()
if(${CMAKE_GENERATOR} MATCHES "Visual Studio") if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
set(CMAKE_Fortran_COMPILER_ID_RUN 1)
set(CMAKE_Fortran_PLATFORM_ID "Windows")
set(CMAKE_Fortran_COMPILER_ID "Intel")
set(CMAKE_Fortran_COMPILER "${CMAKE_GENERATOR_FC}")
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
set(CMAKE_Fortran_COMPILER_XCODE_TYPE sourcecode.fortran.f90) set(CMAKE_Fortran_COMPILER_XCODE_TYPE sourcecode.fortran.f90)
else() else()

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectCreator="Intel Fortran"
Keyword="Console Application"
Version="@CMAKE_VS_INTEL_Fortran_PROJECT_VERSION@"
ProjectIdGuid="{AB67BAB7-D7AE-4E97-B492-FE5420447509}"
>
<Platforms>
<Platform Name="@id_platform@"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|@id_platform@"
OutputDirectory="."
IntermediateDirectory="$(ConfigurationName)"
>
<Tool
Name="VFFortranCompilerTool"
DebugInformationFormat="debugEnabled"
Optimization="optimizeDisabled"
Preprocess="preprocessYes"
RuntimeLibrary="rtMultiThreadedDebugDLL"
/>
<Tool
Name="VFLinkerTool"
LinkIncremental="linkIncrementalNo"
GenerateDebugInformation="true"
SubSystem="subSystemConsole"
/>
<Tool
Name="VFPostBuildEventTool"
CommandLine="for %%i in (@id_cl@) do @echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i"
/>
</Configuration>
</Configurations>
<Files>
<Filter Name="Source Files" Filter="F">
<File RelativePath="@id_src@"/>
</Filter>
</Files>
<Globals/>
</VisualStudioProject>

View File

@ -76,7 +76,6 @@ void cmGlobalVisualStudio7Generator
{ {
mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); mf->AddDefinition("CMAKE_GENERATOR_RC", "rc");
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
mf->AddDefinition("CMAKE_GENERATOR_FC", "ifort");
this->AddPlatformDefinitions(mf); this->AddPlatformDefinitions(mf);
if(!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES")) if(!mf->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
{ {