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] f6b93fbf3a/Modules/Platform/Darwin-Initialize.cmake (L48)
[2] 43b74793de
[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>
This commit is contained in:
David Benjamin 2017-05-11 17:50:25 -04:00 committed by CQ bot account: commit-bot@chromium.org
parent edafe47968
commit 768e6822cc

View File

@ -38,7 +38,9 @@ if(UNIX)
# 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()