summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-12-04 15:36:18 (GMT)
committerBrad King <brad.king@kitware.com>2013-12-04 16:06:44 (GMT)
commite4201248ce76be40c109b67e68a4e295d709e2dc (patch)
tree1fbe95d9c2390d7414268cdb7ddfbff098fc8f1d
parent0c55729c133b7b069f27f19d035444032dda75bd (diff)
downloadCMake-e4201248ce76be40c109b67e68a4e295d709e2dc.zip
CMake-e4201248ce76be40c109b67e68a4e295d709e2dc.tar.gz
CMake-e4201248ce76be40c109b67e68a4e295d709e2dc.tar.bz2
CMakeDetermineCompilerId: Use CMAKE_VS_(DEVENV|MSBUILD|MSDEV)_COMMAND
In the code path for launching the VS IDE tools, avoid using CMAKE_MAKE_PROGRAM. Instead use the variables CMAKE_VS_DEVENV_COMMAND, CMAKE_VS_MSBUILD_COMMAND, and CMAKE_VS_MSDEV_COMMAND to lookup the location of the build tool needed. Choose the proper tool based on availability and necessity for the language (e.g. Intel Fortran must build with devenv.com and not MSBuild.exe).
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake37
1 files changed, 23 insertions, 14 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 7fa4534..93358c7 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -154,24 +154,33 @@ Id flags: ${testflags}
else()
set(id_subsystem 1)
endif()
- if("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Bb][Uu][Ii][Ll][Dd]")
- set(build /p:Configuration=Debug /p:Platform=@id_platform@ /p:VisualStudioVersion=${vs_version}.0)
- 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)
- 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
- )
+ if(CMAKE_VS_MSBUILD_COMMAND AND NOT lang STREQUAL "Fortran")
+ set(command "${CMAKE_VS_MSBUILD_COMMAND}" "CompilerId${lang}.${ext}"
+ "/p:Configuration=Debug" "/p:Platform=${id_platform}" "/p:VisualStudioVersion=${vs_version}.0"
+ )
+ elseif(CMAKE_VS_DEVENV_COMMAND)
+ set(command "${CMAKE_VS_DEVENV_COMMAND}" "CompilerId${lang}.${ext}" "/build" "Debug")
+ elseif(CMAKE_VS_MSDEV_COMMAND)
+ set(command "${CMAKE_VS_MSDEV_COMMAND}" "CompilerId${lang}.${ext}" "/make")
+ else()
+ set(command "")
+ endif()
+ if(command)
+ execute_process(
+ COMMAND ${command}
+ 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
+ )
+ else()
+ set(CMAKE_${lang}_COMPILER_ID_RESULT 1)
+ set(CMAKE_${lang}_COMPILER_ID_OUTPUT "VS environment not known to support ${lang}")
+ endif()
# Match the compiler location line printed out.
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CMAKE_${lang}_COMPILER=([^%\r\n]+)[\r\n]")
# Strip VS diagnostic output from the end of the line.