From 8c891f86cc2cbe346d4f6459d01c6d24c27ec2f1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 3 Sep 2013 13:58:42 -0400 Subject: [PATCH] VS: Tolerate diagnostic output while detecting cl (#14387) When the VS IDE build output setting Tools -> Options -> Projects and Solutions -> Build and Run -> MSBuild project output verbosity is set to "Diagnostic" the build output contains a " (TaskId:###)" suffix on the CMAKE__COMPILER= line used to extract the compiler executable location. Strip this suffix before checking that the reported location exists. --- Modules/CMakeDetermineCompilerId.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index ebd9ce0b9..cc36ec4a8 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -157,7 +157,8 @@ Id flags: ${testflags} ) # 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}") + # Strip VS diagnostic output from the end of the line. + string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _comp "${CMAKE_MATCH_1}") if(EXISTS "${_comp}") file(TO_CMAKE_PATH "${_comp}" _comp) set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)