pw_string: add support for clang

Set clang as the default compiler.

clang needs to explicitly add the math library dependency. Use libm_nano
for the bare-metal platform.

Change-Id: I83afab214274af54e73ce92e3362f3aadf57f9c9
diff --git a/pw_string/CMakeLists.txt b/pw_string/CMakeLists.txt
index a4d12d3..2c70d45 100644
--- a/pw_string/CMakeLists.txt
+++ b/pw_string/CMakeLists.txt
@@ -14,11 +14,27 @@
 
 include($ENV{PW_ROOT}/pw_build/pigweed.cmake)
 
-pw_auto_add_simple_module(pw_string
-  PUBLIC_DEPS
-    pw_assert
-    pw_preprocessor
-    pw_result
-    pw_span
-    pw_status
-)
+set(BUILD_WITH_CLANG ON CACHE BOOL "Build the library with clang.")
+
+if(${BUILD_WITH_CLANG})
+  find_library(m_nano m_nano)
+
+  pw_auto_add_simple_module(pw_string
+    PUBLIC_DEPS
+      pw_assert
+      pw_preprocessor
+      pw_result
+      pw_span
+      pw_status
+      m_nano
+  )
+else()
+  pw_auto_add_simple_module(pw_string
+    PUBLIC_DEPS
+      pw_assert
+      pw_preprocessor
+      pw_result
+      pw_span
+      pw_status
+  )
+endif(${BUILD_WITH_CLANG})