Use MacPorts Binutils path for macOS, #4028

This commit is contained in:
Morgan Hardwood
2018-03-12 07:27:46 +01:00
parent 8f9fb2db80
commit 2e9dc11440

View File

@@ -339,8 +339,13 @@ if(WITH_LTO)
execute_process(COMMAND ar --version OUTPUT_VARIABLE BINUTILS_VERSION_DETECTED)
string(REGEX REPLACE ".* ([0-9.]+)\n.*" "\\1" BINUTILS_VERSION_DETECTED "${BINUTILS_VERSION_DETECTED}")
if("${BINUTILS_VERSION_DETECTED}" VERSION_LESS "${BINUTILS_VERSION_MININUM}")
SET(CMAKE_AR "/usr/bin/gcc-ar")
SET(CMAKE_RANLIB "/usr/bin/gcc-ranlib")
if(APPLE)
SET(CMAKE_AR "/opt/local/bin/ar")
SET(CMAKE_RANLIB "/opt/local/bin/ranlib")
else()
SET(CMAKE_AR "/usr/bin/gcc-ar")
SET(CMAKE_RANLIB "/usr/bin/gcc-ranlib")
endif()
message(STATUS "Binutils version detected as less than " ${BINUTILS_VERSION_MININUM} " - setting CMake parameters to enable LTO linking:\n CMAKE_AR=\"" ${CMAKE_AR} "\"\n CMAKE_RANLIB=\"" ${CMAKE_RANLIB} "\"")
endif()