CMAKE_OSX_SYSROOT value differs from value in cache
Apologies if this is expected behaviour but I couldn't find any information about it.
When building for iOS using a single config generator such as makefiles, we want to use different search paths for libraries depending on whether we're building for device or simulator. It seems the best way to do this is to use the value of CMAKE_OSX_SYSROOT
, however this value is different depending on whether I check the cache value or not, example CMakeLists.txt:
cmake_minimum_required(VERSION 3.26)
project(ios-test)
message(STATUS "CMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}")
message(STATUS "CACHE{CMAKE_OSX_SYSROOT}=$CACHE{CMAKE_OSX_SYSROOT}")
Using cmake 3.26.1 running cmake -B build -DCMAKE_SYSTEM_NAME=iOS
outputs:
-- CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk
-- CACHE{CMAKE_OSX_SYSROOT}=iphoneos
This is not so much of an issue as I can use the cache value for this purpose but it seems odd that the values would be different