Repository: arrow Updated Branches: refs/heads/master c9e61cd77 -> da523ce72
ARROW-928: [C++] Detect supported MSVC versions Author: Max Risuhin <[email protected]> Closes #625 from MaxRis/ARROW-928 and squashes the following commits: db81a27 [Max Risuhin] ARROW-928: [C++] Detect supported MSVC versions Project: http://git-wip-us.apache.org/repos/asf/arrow/repo Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/da523ce7 Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/da523ce7 Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/da523ce7 Branch: refs/heads/master Commit: da523ce72524de6243b8ea3c40cf50f92d60ac3e Parents: c9e61cd Author: Max Risuhin <[email protected]> Authored: Mon May 1 16:38:21 2017 -0400 Committer: Wes McKinney <[email protected]> Committed: Mon May 1 16:38:21 2017 -0400 ---------------------------------------------------------------------- cpp/cmake_modules/CompilerInfo.cmake | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/arrow/blob/da523ce7/cpp/cmake_modules/CompilerInfo.cmake ---------------------------------------------------------------------- diff --git a/cpp/cmake_modules/CompilerInfo.cmake b/cpp/cmake_modules/CompilerInfo.cmake index 3c60391..21e2daf 100644 --- a/cpp/cmake_modules/CompilerInfo.cmake +++ b/cpp/cmake_modules/CompilerInfo.cmake @@ -17,7 +17,11 @@ # # Sets COMPILER_FAMILY to 'clang' or 'gcc' # Sets COMPILER_VERSION to the version -execute_process(COMMAND "${CMAKE_CXX_COMPILER}" -v +if (NOT MSVC) + set(COMPILER_GET_VERSION_SWITCH "-v") +endif() + +execute_process(COMMAND "${CMAKE_CXX_COMPILER}" ${COMPILER_GET_VERSION_SWITCH} ERROR_VARIABLE COMPILER_VERSION_FULL) message(INFO "Compiler version: ${COMPILER_VERSION_FULL}") message(INFO "Compiler id: ${CMAKE_CXX_COMPILER_ID}") @@ -25,6 +29,13 @@ string(TOLOWER "${COMPILER_VERSION_FULL}" COMPILER_VERSION_FULL_LOWER) if(MSVC) set(COMPILER_FAMILY "msvc") + if ("${COMPILER_VERSION_FULL}" MATCHES ".*Microsoft \\(R\\) C/C\\+\\+ Optimizing Compiler Version 19.*x64") + string(REGEX REPLACE ".*Optimizing Compiler Version ([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" + COMPILER_VERSION "${COMPILER_VERSION_FULL}") + elseif(NOT "${COMPILER_VERSION_FULL}" STREQUAL "") + message(FATAL_ERROR "Not supported MSVC compiler:\n${COMPILER_VERSION_FULL}\n" + "Supported MSVC versions: Visual Studio 2015 2017 x64") + endif() # clang on Linux and Mac OS X before 10.9 elseif("${COMPILER_VERSION_FULL}" MATCHES ".*clang version.*")
