aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-09-10 15:11:16 +0200
committerRiccardo Spagni <ric@spagni.net>2016-09-10 15:11:16 +0200
commit1d0578f8d3ae0340363d425dd2183195c4a13ea5 (patch)
tree04974a25c5012bf215b445731d47dc35b68553c6
parentMerge pull request #1044 (diff)
parentcmake: handle dists which prefix gcc binaries wth arch triplet (diff)
downloadmonero-1d0578f8d3ae0340363d425dd2183195c4a13ea5.tar.xz
Merge pull request #1047
0f94f61 cmake: handle dists which prefix gcc binaries wth arch triplet (redfish)
-rw-r--r--CMakeLists.txt14
1 files changed, 12 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 519ce635d..0b0ce5a4e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -497,8 +497,18 @@ else()
endif()
# Since gcc 4.9 the LTO format is non-standard (slim), so we need the gcc-specific ar and ranlib binaries
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0) AND NOT OPENBSD)
- set(CMAKE_AR "gcc-ar")
- set(CMAKE_RANLIB "gcc-ranlib")
+ # When invoking cmake on distributions on which gcc's binaries are prefix
+ # with an arch-specific triplet, the user has to either specify
+ # -DCHOST=... or -DCMAKE_AR=... and -DCMAKE_RANLIB=...
+ if (DEFINED CHOST)
+ set(CHOST_PREFIX "${CHOST}-")
+ endif()
+ if (NOT DEFINED CMAKE_AR)
+ set(CMAKE_AR "${CHOST_PREFIX}gcc-ar")
+ endif()
+ if (NOT DEFINED CMAKE_RANLIB)
+ set(CMAKE_RANLIB "${CHOST_PREFIX}gcc-ranlib")
+ endif()
endif()
endif()