GNU-FindBinUtils.cmake 1.1 KB

12345678910111213141516171819202122232425
  1. if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL "")
  2. message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set")
  3. endif()
  4. string(REGEX MATCH "^([0-9]+\\.[0-9]+)" __version_x_y
  5. "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}")
  6. # Try to find tools in the same directory as GCC itself
  7. get_filename_component(__gcc_hints "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" DIRECTORY)
  8. # http://manpages.ubuntu.com/manpages/wily/en/man1/gcc-ar.1.html
  9. find_program(CMAKE_GCC_AR NAMES
  10. "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar"
  11. "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x_y}"
  12. HINTS ${__gcc_hints}
  13. DOC "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler"
  14. )
  15. # http://manpages.ubuntu.com/manpages/wily/en/man1/gcc-ranlib.1.html
  16. find_program(CMAKE_GCC_RANLIB NAMES
  17. "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib"
  18. "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x_y}"
  19. HINTS ${__gcc_hints}
  20. DOC "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler"
  21. )