From: Vladimir Smirnov Date: Sun, 2 May 2021 12:56:16 +0000 (+0200) Subject: Fix cmake detection of risc-v (32 and 64 bit) X-Git-Tag: 2.0.3~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=81f1c8a41bd1427707f402450de8820816760fca;p=thirdparty%2Fzlib-ng.git Fix cmake detection of risc-v (32 and 64 bit) Add a case to detect risc-v architectures. Fixes #941 --- diff --git a/cmake/detect-arch.c b/cmake/detect-arch.c index 57155358..c8bad4be 100644 --- a/cmake/detect-arch.c +++ b/cmake/detect-arch.c @@ -93,6 +93,13 @@ #elif defined(__THW_RS6000) #error archfound rs6000 +// RISC-V +#elif defined(__riscv) + #if __riscv_xlen == 64 + #error archfound riscv64 + #elif __riscv_xlen == 32 + #error archfound riscv32 + // return 'unrecognized' if we do not know what architecture this is #else #error archfound unrecognized diff --git a/cmake/detect-arch.cmake b/cmake/detect-arch.cmake index 69475da3..76b52b9f 100644 --- a/cmake/detect-arch.cmake +++ b/cmake/detect-arch.cmake @@ -85,6 +85,9 @@ elseif("${ARCH}" MATCHES "parisc") elseif("${ARCH}" MATCHES "rs6000") set(BASEARCH "rs6000") set(BASEARCH_RS6000_FOUND TRUE) +elseif("${ARCH}" MATCHES "riscv(32|64)") + set(BASEARCH "riscv") + set(BASEARCH_RISCV_FOUND TRUE) else() set(BASEARCH "x86") set(BASEARCH_X86_FOUND TRUE)