diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 7f0ffee35..01859b60b 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -40,10 +40,6 @@ if(NOT CMAKE_C_COMPILER_NAMES)
endif()
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
- set(CMAKE_C_COMPILER_ID_RUN 1)
- set(CMAKE_C_PLATFORM_ID "Windows")
- set(CMAKE_C_COMPILER_ID "MSVC")
- set(CMAKE_C_COMPILER "${CMAKE_GENERATOR_CC}")
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
set(CMAKE_C_COMPILER_XCODE_TYPE sourcecode.c.c)
else()
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 110fcb184..3f97b40c7 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -39,10 +39,6 @@ if(NOT CMAKE_CXX_COMPILER_NAMES)
endif()
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
- set(CMAKE_CXX_COMPILER_ID_RUN 1)
- set(CMAKE_CXX_PLATFORM_ID "Windows")
- set(CMAKE_CXX_COMPILER_ID "MSVC")
- set(CMAKE_CXX_COMPILER "${CMAKE_GENERATOR_CXX}")
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
set(CMAKE_CXX_COMPILER_XCODE_TYPE sourcecode.cpp.cpp)
else()
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index d0c1ea576..bd88c3ff2 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -107,7 +107,68 @@ Id flags: ${testflags}
")
# Compile the compiler identification source.
- if("${CMAKE_GENERATOR}" MATCHES "Xcode")
+ if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)( .NET)?( 200[358])? *((Win64|IA64|ARM))?")
+ set(vs_version ${CMAKE_MATCH_1})
+ set(vs_arch ${CMAKE_MATCH_4})
+ set(id_lang "${lang}")
+ set(id_cl cl.exe)
+ if(NOT "${vs_version}" VERSION_LESS 10)
+ set(v 10)
+ set(ext vcxproj)
+ elseif(NOT "${vs_version}" VERSION_LESS 7)
+ set(id_version ${vs_version}.00)
+ set(v 7)
+ set(ext vcproj)
+ else()
+ set(v 6)
+ set(ext dsp)
+ endif()
+ if("${vs_arch}" STREQUAL "Win64")
+ set(id_machine_7 17)
+ set(id_machine_10 MachineX64)
+ set(id_arch x64)
+ elseif("${vs_arch}" STREQUAL "IA64")
+ set(id_machine_7 5)
+ set(id_machine_10 MachineIA64)
+ set(id_arch ia64)
+ else()
+ set(id_machine_6 x86)
+ set(id_machine_7 1)
+ set(id_machine_10 MachineX86)
+ set(id_arch Win32)
+ endif()
+ if(CMAKE_VS_PLATFORM_TOOLSET)
+ set(id_toolset "${CMAKE_VS_PLATFORM_TOOLSET}")
+ else()
+ set(id_toolset "")
+ endif()
+ if("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Bb][Uu][Ii][Ll][Dd]")
+ set(build /p:Configuration=Debug /p:Platform=@id_arch@)
+ elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Dd][Ee][Vv]")
+ set(build /make)
+ else()
+ set(build /build Debug)
+ endif()
+ set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
+ get_filename_component(id_src "${src}" NAME)
+ configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
+ ${id_dir}/CompilerId${lang}.${ext} @ONLY IMMEDIATE)
+ execute_process(
+ COMMAND ${CMAKE_MAKE_PROGRAM} CompilerId${lang}.${ext} ${build}
+ WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
+ OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
+ ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
+ RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
+ )
+ # Match the compiler location line printed out.
+ if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CMAKE_${lang}_COMPILER=([^%\r\n]+)[\r\n]")
+ set(_comp "${CMAKE_MATCH_1}")
+ if(EXISTS "${_comp}")
+ file(TO_CMAKE_PATH "${_comp}" _comp)
+ set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
+ endif()
+ endif()
+ elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
set(id_lang "${lang}")
set(id_type ${CMAKE_${lang}_COMPILER_XCODE_TYPE})
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in
new file mode 100644
index 000000000..ab4705fa3
--- /dev/null
+++ b/Modules/CompilerId/VS-10.vcxproj.in
@@ -0,0 +1,53 @@
+
+
+
+
+ Debug
+ @id_arch@
+
+
+
+ {CAE07175-D007-4FC3-BFE8-47B392814159}
+ CompilerId@id_lang@
+ Win32Proj
+
+
+
+ Application
+ @id_toolset@
+ MultiByte
+
+
+
+ <_ProjectFileVersion>10.0.30319.1
+ .\
+ $(Configuration)\
+ false
+
+
+
+ Disabled
+ %(PreprocessorDefinitions)
+ false
+ EnableFastChecks
+ MultiThreadedDebugDLL
+
+
+ TurnOffAllWarnings
+
+
+
+
+ false
+ Console
+ @id_machine_10@
+
+
+ for %%i in (@id_cl@) do %40echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i
+
+
+
+
+
+
+
diff --git a/Modules/CompilerId/VS-6.dsp.in b/Modules/CompilerId/VS-6.dsp.in
new file mode 100644
index 000000000..4f7e67613
--- /dev/null
+++ b/Modules/CompilerId/VS-6.dsp.in
@@ -0,0 +1,48 @@
+# Microsoft Developer Studio Project File - Name="CompilerId@id_lang@" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+
+# TARGTYPE "Win32 (@id_machine_6@) Application" 0x0101
+
+CFG=CompilerId@id_lang@ - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "CompilerId@id_lang@.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "CompilerId@id_lang@.mak" CFG="CompilerId@id_lang@ - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "CompilerId@id_lang@ - Win32 Debug" (based on "Win32 (@id_machine_6@) Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "."
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD CPP /nologo /MDd /c
+LINK32=link.exe
+# ADD LINK32 /nologo /version:0.0 /subsystem:console /machine:@id_machine_6@ /out:"CompilerId@id_lang@.exe" /IGNORE:4089
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Cmds=for %%i in (@id_cl@) do @echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i
+# End Special Build Tool
+# Begin Target
+
+# Name "CompilerId@id_lang@ - Win32 Debug"
+# Begin Group "Source Files"
+
+# Begin Source File
+
+SOURCE="@id_src@"
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/Modules/CompilerId/VS-7.vcproj.in b/Modules/CompilerId/VS-7.vcproj.in
new file mode 100644
index 000000000..71bf64de2
--- /dev/null
+++ b/Modules/CompilerId/VS-7.vcproj.in
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+