Fix threads detection for CROS_EC/CROS_ZEPHYR

The CROS_EC and CROS_ZEPHYR platforms currently have threads disabled,
so we should not attempt to search for (or link) a threads library.

BUG=b/273639386

Change-Id: I094a989680160f9ecefbdb4cb3e94c4825a651e3
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65568
Reviewed-by: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt
index 6dd5f23..94327cc 100644
--- a/crypto/CMakeLists.txt
+++ b/crypto/CMakeLists.txt
@@ -342,7 +342,11 @@
   target_link_libraries(crypto ws2_32)
 endif()
 
-if(NOT ANDROID)
+# CMAKE_SYSTEM_NAME is "Generic" for embedded OSes:
+# https://cmake.org/cmake/help/book/mastering-cmake/chapter/Cross%20Compiling%20With%20CMake.html#toolchain-files
+#
+# For now we assume embedded OSes do not have threads.
+if(NOT (ANDROID OR CMAKE_SYSTEM_NAME STREQUAL "Generic"))
   find_package(Threads REQUIRED)
   target_link_libraries(crypto Threads::Threads)
 endif()