summaryrefslogtreecommitdiff
path: root/Modules/CMakeFindBinUtils.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/CMakeFindBinUtils.cmake')
-rw-r--r--Modules/CMakeFindBinUtils.cmake42
1 files changed, 22 insertions, 20 deletions
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index e70c013be..e4103d0b7 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -1,3 +1,6 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
# search for additional tools required for C/C++ (and other languages ?)
#
@@ -16,23 +19,19 @@
# on UNIX, cygwin and mingw
-#=============================================================================
-# Copyright 2007-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
# 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"
- OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
+if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC"
+ OR "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC"
+ OR (CMAKE_HOST_WIN32 AND (
+ "x${CMAKE_C_COMPILER_ID}" STREQUAL "xPGI"
+ OR "x${CMAKE_Fortran_COMPILER_ID}" STREQUAL "xPGI"
+ ))
+ OR (CMAKE_GENERATOR MATCHES "Visual Studio"
+ AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))
find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
@@ -40,7 +39,12 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
# in all other cases search for ar, ranlib, etc.
else()
-
+ if(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN)
+ set(_CMAKE_TOOLCHAIN_LOCATION ${_CMAKE_TOOLCHAIN_LOCATION} ${CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN}/bin)
+ endif()
+ if(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN)
+ set(_CMAKE_TOOLCHAIN_LOCATION ${_CMAKE_TOOLCHAIN_LOCATION} ${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}/bin)
+ endif()
find_program(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar${_CMAKE_TOOLCHAIN_SUFFIX} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
find_program(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
@@ -58,9 +62,7 @@ else()
endif()
-
-# on Apple there really should be install_name_tool
-if(APPLE)
+if(CMAKE_PLATFORM_HAS_INSTALLNAME)
find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
if(NOT CMAKE_INSTALL_NAME_TOOL)