diff options
author | Brad King <brad.king@kitware.com> | 2013-12-05 14:24:59 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-12-05 14:24:59 (GMT) |
commit | 520ead7200334fddcbef94c657de025abe5cf134 (patch) | |
tree | c6faa3f3d792a1efff4da8f1618841167657b053 /Modules/CMakeDetermineCompilerId.cmake | |
parent | 7974dbb0ffe9c4abb314ec6baff4f0af1d99e5f5 (diff) | |
parent | e4201248ce76be40c109b67e68a4e295d709e2dc (diff) | |
download | CMake-520ead7200334fddcbef94c657de025abe5cf134.zip CMake-520ead7200334fddcbef94c657de025abe5cf134.tar.gz CMake-520ead7200334fddcbef94c657de025abe5cf134.tar.bz2 |
Merge topic 'cleanup-build-commands'
e420124 CMakeDetermineCompilerId: Use CMAKE_VS_(DEVENV|MSBUILD|MSDEV)_COMMAND
0c55729 VS: Add CMAKE_VS_(DEVENV|MSBUILD|MSDEV)_COMMAND variables
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index efb06c0..518b8c6 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. |