diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 05273979d..47ac5c3c6 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -18,7 +18,10 @@ # if it's the MS C/CXX compiler, search for link -IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC") +IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" + OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC" + OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio") + FIND_PROGRAM(CMAKE_LINKER NAMES link PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) FIND_PROGRAM(CMAKE_LINKER NAMES link) @@ -29,7 +32,9 @@ IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_C_COMPILER_ID}" MATCHES MARK_AS_ADVANCED(CMAKE_LINKER) # in all other cases search for ar, ranlib, etc. -ELSE("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC") +ELSE("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" + OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC" + OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio") FIND_PROGRAM(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar PATHS ${_CMAKE_TOOLCHAIN_LOCATION} NO_DEFAULT_PATH) FIND_PROGRAM(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar) @@ -47,7 +52,9 @@ ELSE("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_C_COMPILER_ID}" MATCH FIND_PROGRAM(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld) MARK_AS_ADVANCED(CMAKE_AR CMAKE_RANLIB CMAKE_STRIP CMAKE_LINKER) -ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC") +ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" + OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC" + OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio") # on Apple there really should be install_name_tool