diff options
| author | redfish <redfish@galactica.pw> | 2016-08-31 22:21:22 -0400 |
|---|---|---|
| committer | redfish <redfish@galactica.pw> | 2016-08-31 22:21:22 -0400 |
| commit | 0f94f61805d53fc19b97291b7cfd400e4c4e513a (patch) | |
| tree | 4f8721ef76877500c07aac789cb47dbd2f86a3d1 | |
| parent | c3ba844f03a88bbf6b2624f719f5cb9184a07445 (diff) | |
| download | monzero-core-0f94f61805d53fc19b97291b7cfd400e4c4e513a.tar.gz monzero-core-0f94f61805d53fc19b97291b7cfd400e4c4e513a.tar.xz monzero-core-0f94f61805d53fc19b97291b7cfd400e4c4e513a.zip | |
cmake: handle dists which prefix gcc binaries wth arch triplet
Issue #1026
| -rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ff1590860..e280826c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -417,8 +417,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() |
