You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-cpp/folly/files/folly-2022.08.08.00-undefin...

63 lines
1.8 KiB

https://github.com/facebook/folly/commit/10fc2e449038d9ffda5cd53999edb9875c4cb151
From 10fc2e449038d9ffda5cd53999edb9875c4cb151 Mon Sep 17 00:00:00 2001
From: Simon Marlow <smarlow@fb.com>
Date: Fri, 12 Aug 2022 08:26:40 -0700
Subject: [PATCH] Fix bugs in Cmake setup
Summary:
Please see https://github.com/facebook/folly/issues/1823 and
https://github.com/facebook/folly/issues/1478
* CMAKE_LIBRARY_ARCHITECTURE is not always defined
* This doesn't work: `set(IS_X86_64_ARCH NOT(IS_X86_64_ARCH STREQUAL "-1"))`
* Two conditionals for `IS_X86_64_ARCH` were reversed
Reviewed By: bochko
Differential Revision: D38653631
fbshipit-source-id: c4b6f2820a2280356a7eb69bf0e9253434b5e750
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,8 +27,19 @@ if(POLICY CMP0075)
cmake_policy(SET CMP0075 NEW)
endif()
-string(FIND "${CMAKE_LIBRARY_ARCHITECTURE}" "x86_64" IS_X86_64_ARCH)
-set(IS_X86_64_ARCH NOT(IS_X86_64_ARCH STREQUAL "-1"))
+if("${CMAKE_LIBRARY_ARCHITECTURE}" STREQUAL "")
+ # CMAKE_LIBRARY_ARCHITECTURE is not always set, so we have to assume
+ # arch might be x86_64
+ message(WARNING "CMAKE_LIBRARY_ARCHITECTURE not set, assuming x86_64")
+ set(IS_X86_64_ARCH ON)
+else()
+ string(FIND "${CMAKE_LIBRARY_ARCHITECTURE}" "x86_64" IS_X86_64_ARCH)
+ if(IS_X86_64_ARCH STREQUAL "-1")
+ set(IS_X86_64_ARCH OFF)
+ else()
+ set(IS_X86_64_ARCH ON)
+ endif()
+endif()
# includes
set(CMAKE_MODULE_PATH
@@ -230,7 +241,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()
# base64 SIMD files compilation
-if (${IS_X86_64_ARCH})
+if (NOT(${IS_X86_64_ARCH}))
message(
STATUS
"arch ${CMAKE_LIBRARY_ARCHITECTURE} does not match x86_64, "
@@ -256,7 +267,7 @@ else()
endif()
if (${LIBSODIUM_FOUND})
- if (${IS_X86_64_ARCH})
+ if (NOT(${IS_X86_64_ARCH}))
message(
STATUS
"arch ${CMAKE_LIBRARY_ARCHITECTURE} does not match x86_64, "