diff options
author | Brad King <brad.king@kitware.com> | 2020-04-08 15:28:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-04-08 15:51:02 (GMT) |
commit | 45fa9b32caae2a45adf4e7eec8e69fc0a149a4ff (patch) | |
tree | f6a600e78131df281418b09211dd91c254dcb0a4 | |
parent | 3d61ff7b1028b00119d4b1388e9fe0fca34499ff (diff) | |
download | CMake-45fa9b32caae2a45adf4e7eec8e69fc0a149a4ff.zip CMake-45fa9b32caae2a45adf4e7eec8e69fc0a149a4ff.tar.gz CMake-45fa9b32caae2a45adf4e7eec8e69fc0a149a4ff.tar.bz2 |
Apple: Improve handling of missing SDKs in CMAKE_APPLE_ARCH_SYSROOTS
Use `<arch>-SDK-NOTFOUND` instead of an empty string as a placeholder in
`CMAKE_APPLE_ARCH_SYSROOTS` for architectures whose SDK is not found.
This ensures the length of `CMAKE_APPLE_ARCH_SYSROOTS` matches the
length of `CMAKE_OSX_ARCHITECTURES`. It also makes the missing SDKs
more visible in the value.
Issue: #20534
-rw-r--r-- | Modules/Platform/Darwin-Initialize.cmake | 4 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake index 729217c..80e668e 100644 --- a/Modules/Platform/Darwin-Initialize.cmake +++ b/Modules/Platform/Darwin-Initialize.cmake @@ -136,7 +136,7 @@ endfunction() # Handle multi-arch sysroots. Do this before CMAKE_OSX_SYSROOT is # transformed into a path, so that we know the sysroot name. function(_apple_resolve_multi_arch_sysroots) - if(CMAKE_APPLE_ARCH_SYSROOTS) + if(DEFINED CMAKE_APPLE_ARCH_SYSROOTS) return() # Already cached endif() @@ -202,7 +202,7 @@ function(_apple_resolve_multi_arch_sysroots) list(APPEND _arch_sysroots ${_arch_sysroot}) else() message(WARNING "No SDK found for architecture '${arch}'") - list(APPEND _arch_sysroots "") # Placeholder + list(APPEND _arch_sysroots "${arch}-SDK-NOTFOUND") endif() endforeach() diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 00ad62e..62a5e0c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1800,7 +1800,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, if (!arch_sysroots.empty()) { assert(arch_sysroots.size() == archs.size()); for (size_t i = 0; i < archs.size(); ++i) { - if (arch_sysroots[i].empty()) { + if (cmIsOff(arch_sysroots[i])) { continue; } flags += " -Xarch_" + archs[i] + " "; |