GNU-FindBinUtils.cmake 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  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. # Ubuntu 16.04:
  5. # * /usr/bin/gcc-ar-5
  6. # * /usr/bin/gcc-ranlib-5
  7. string(REGEX MATCH "^([0-9]+)" __version_x
  8. "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}")
  9. string(REGEX MATCH "^([0-9]+\\.[0-9]+)" __version_x_y
  10. "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}")
  11. # Try to find tools in the same directory as GCC itself
  12. get_filename_component(__gcc_hints "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" DIRECTORY)
  13. # http://manpages.ubuntu.com/manpages/wily/en/man1/gcc-ar.1.html
  14. find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES
  15. "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x_y}"
  16. "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x}"
  17. "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_COMPILER_SUFFIX}"
  18. HINTS ${__gcc_hints}
  19. DOC "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler"
  20. )
  21. mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR)
  22. # http://manpages.ubuntu.com/manpages/wily/en/man1/gcc-ranlib.1.html
  23. find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES
  24. "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x_y}"
  25. "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x}"
  26. "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib${_CMAKE_COMPILER_SUFFIX}"
  27. HINTS ${__gcc_hints}
  28. DOC "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler"
  29. )
  30. mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB)