Only fixup CMAKE_ASM_FLAGS -isysroot if CMAKE_OSX_SYSROOT is set.

Sometimes[1] CMake will do a build on Darwin without setting up
CMAKE_OSX_SYSROOT. This appears to be to support the "basic POSIX-only
case"[2]. The hard-coded CMake logic we're mimicking[3] handles this
case, so do the same.

[1] https://github.com/Kitware/CMake/blob/f6b93fbf3ae00a9157af2f6497bed074d585cea9/Modules/Platform/Darwin-Initialize.cmake#L48
[2] https://github.com/Kitware/CMake/commit/43b74793de80153b9446689adf79c4acf1391969
[3] https://github.com/Kitware/CMake/blob/master/Source/cmLocalGenerator.cxx#L1307

Change-Id: Ica5ae8510d07eca384cc366dd3de10b0c1ce0f81
Reviewed-on: https://boringssl-review.googlesource.com/16245
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt
index 0ca2847..557246c 100644
--- a/crypto/CMakeLists.txt
+++ b/crypto/CMakeLists.txt
@@ -38,7 +38,9 @@
 
   # CMake does not add -isysroot and -arch flags to assembly.
   if (APPLE)
-    set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -isysroot ${CMAKE_OSX_SYSROOT}")
+    if (CMAKE_OSX_SYSROOT)
+      set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -isysroot ${CMAKE_OSX_SYSROOT}")
+    endif()
     foreach(arch ${CMAKE_OSX_ARCHITECTURES})
       set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -arch ${arch}")
     endforeach()