2 # search for additional tools required for C/C++ (and other languages ?)
4 # If the internal cmake variable _CMAKE_TOOLCHAIN_PREFIX is set, this is used
5 # as prefix for the tools (e.g. arm-elf-gcc etc.)
6 # If the cmake variable _CMAKE_TOOLCHAIN_LOCATION is set, the compiler is
7 # searched only there. The other tools are at first searched there, then
8 # also in the default locations.
10 # Sets the following variables:
15 # CMAKE_INSTALL_NAME_TOOL
17 # on UNIX, cygwin and mingw
20 # if it's the MS C/CXX compiler, search for link
21 IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
22 OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
23 OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
25 FIND_PROGRAM(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
27 MARK_AS_ADVANCED(CMAKE_LINKER)
29 # in all other cases search for ar, ranlib, etc.
30 ELSE("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
31 OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
32 OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
34 FIND_PROGRAM(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
36 FIND_PROGRAM(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
38 SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib")
39 ENDIF(NOT CMAKE_RANLIB)
41 FIND_PROGRAM(CMAKE_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
42 FIND_PROGRAM(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
43 FIND_PROGRAM(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
44 FIND_PROGRAM(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
45 FIND_PROGRAM(CMAKE_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
47 MARK_AS_ADVANCED(CMAKE_AR CMAKE_RANLIB CMAKE_STRIP CMAKE_LINKER CMAKE_NM CMAKE_OBJDUMP CMAKE_OBJCOPY)
49 ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
50 OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
51 OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
54 # on Apple there really should be install_name_tool
56 FIND_PROGRAM(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
58 IF(NOT CMAKE_INSTALL_NAME_TOOL)
59 MESSAGE(FATAL_ERROR "Could not find install_name_tool, please check your installation.")
60 ENDIF(NOT CMAKE_INSTALL_NAME_TOOL)
62 MARK_AS_ADVANCED(CMAKE_INSTALL_NAME_TOOL)