Skip to content

Commit e1aa148

Browse files
authored
Prevents user-configured iOS and OXS deployment targets from being overwritten. (#23)
This commit fixes an issue where user-configured iOS and OXS deployment targets are overwritten by suggested minimum targets.
1 parent b03c1da commit e1aa148

File tree

2 files changed

+45
-41
lines changed

2 files changed

+45
-41
lines changed

os/iphone-default-sdk.cmake

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ endif()
1313

1414
include(polly_status_debug)
1515

16-
# polly_find_xcode_ios_defaults :
17-
# fills
16+
# polly_find_xcode_ios_defaults :
17+
# fills
1818
# * XCODE_DEVELOPER_ROOT
19-
# * IPHONEOS_ROOT
19+
# * IPHONEOS_ROOT
2020
# * IPHONEOS_SDK_ROOT
2121
macro (polly_find_xcode_ios_defaults)
2222
find_program(XCODE_SELECT_EXECUTABLE xcode-select)
@@ -27,7 +27,7 @@ macro (polly_find_xcode_ios_defaults)
2727
COMMAND
2828
${XCODE_SELECT_EXECUTABLE}
2929
"-print-path"
30-
OUTPUT_VARIABLE
30+
OUTPUT_VARIABLE
3131
XCODE_DEVELOPER_ROOT # /.../Xcode.app/Contents/Developer
3232
OUTPUT_STRIP_TRAILING_WHITESPACE
3333
RESULT_VARIABLE
@@ -73,22 +73,24 @@ if(NOT "${_POLLY_PROCESS_RESULT}" EQUAL "0")
7373
endif()
7474
polly_status_debug("IOS_SDK_VERSION=${IOS_SDK_VERSION}")
7575

76-
# Get minimum suggested Deployment SDK version
77-
execute_process(
78-
COMMAND
79-
"/usr/libexec/PlistBuddy"
80-
-c "print 'DefaultProperties':DEPLOYMENT_TARGET_SUGGESTED_VALUES:0"
81-
${IPHONEOS_SDK_ROOT}/SDKSettings.plist
82-
RESULT_VARIABLE _POLLY_PROCESS_RESULT2
83-
OUTPUT_VARIABLE IOS_DEPLOYMENT_SDK_VERSION
84-
OUTPUT_STRIP_TRAILING_WHITESPACE
85-
ERROR_STRIP_TRAILING_WHITESPACE
86-
)
87-
if(NOT "${_POLLY_PROCESS_RESULT2}" EQUAL "0")
88-
polly_fatal_error("Could not read the minimum suggested Deployment iPhoneSDK version ().
89-
The command
90-
/usr/libexec/PlistBuddy -c \"print 'DefaultProperties':DEPLOYMENT_TARGET_SUGGESTED_VALUES:0\" ${IPHONEOS_SDK_ROOT}/SDKSettings.plist
91-
failed with the following status : ${_POLLY_PROCESS_RESULT2}
92-
")
76+
if(NOT IOS_DEPLOYMENT_SDK_VERSION)
77+
# Get minimum suggested Deployment SDK version
78+
execute_process(
79+
COMMAND
80+
"/usr/libexec/PlistBuddy"
81+
-c "print 'DefaultProperties':DEPLOYMENT_TARGET_SUGGESTED_VALUES:0"
82+
${IPHONEOS_SDK_ROOT}/SDKSettings.plist
83+
RESULT_VARIABLE _POLLY_PROCESS_RESULT2
84+
OUTPUT_VARIABLE IOS_DEPLOYMENT_SDK_VERSION
85+
OUTPUT_STRIP_TRAILING_WHITESPACE
86+
ERROR_STRIP_TRAILING_WHITESPACE
87+
)
88+
if(NOT "${_POLLY_PROCESS_RESULT2}" EQUAL "0")
89+
polly_fatal_error("Could not read the minimum suggested Deployment iPhoneSDK version ().
90+
The command
91+
/usr/libexec/PlistBuddy -c \"print 'DefaultProperties':DEPLOYMENT_TARGET_SUGGESTED_VALUES:0\" ${IPHONEOS_SDK_ROOT}/SDKSettings.plist
92+
failed with the following status : ${_POLLY_PROCESS_RESULT2}
93+
")
94+
endif()
9395
endif()
9496
polly_status_debug("IOS_DEPLOYMENT_SDK_VERSION=${IOS_DEPLOYMENT_SDK_VERSION}")

os/osx-default-sdk.cmake

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ endif()
1313

1414
include(polly_status_debug)
1515

16-
# polly_find_xcode_macos_defaults :
17-
# fills
16+
# polly_find_xcode_macos_defaults :
17+
# fills
1818
# * XCODE_DEVELOPER_ROOT
19-
# * MACOS_ROOT
19+
# * MACOS_ROOT
2020
# * MACOS_SDK_ROOT
2121
macro (polly_find_xcode_macos_defaults)
2222
find_program(XCODE_SELECT_EXECUTABLE xcode-select)
@@ -27,7 +27,7 @@ macro (polly_find_xcode_macos_defaults)
2727
COMMAND
2828
${XCODE_SELECT_EXECUTABLE}
2929
"-print-path"
30-
OUTPUT_VARIABLE
30+
OUTPUT_VARIABLE
3131
XCODE_DEVELOPER_ROOT # /.../Xcode.app/Contents/Developer
3232
OUTPUT_STRIP_TRAILING_WHITESPACE
3333
RESULT_VARIABLE
@@ -74,21 +74,23 @@ endif()
7474
polly_status_debug("OSX_SDK_VERSION=${OSX_SDK_VERSION}")
7575

7676
# Get minimum suggested Deployment SDK version
77-
execute_process(
78-
COMMAND
79-
"/usr/libexec/PlistBuddy"
80-
-c "print 'DefaultProperties':DEPLOYMENT_TARGET_SUGGESTED_VALUES:0"
81-
${MACOS_SDK_ROOT}/SDKSettings.plist
82-
RESULT_VARIABLE _POLLY_PROCESS_RESULT2
83-
OUTPUT_VARIABLE OSX_DEPLOYMENT_SDK_VERSION
84-
OUTPUT_STRIP_TRAILING_WHITESPACE
85-
ERROR_STRIP_TRAILING_WHITESPACE
86-
)
87-
if(NOT "${_POLLY_PROCESS_RESULT2}" EQUAL "0")
88-
polly_fatal_error("Could not read the minimum suggested Deployment macOS SDK version ().
89-
The command
90-
/usr/libexec/PlistBuddy -c \"print 'DefaultProperties':DEPLOYMENT_TARGET_SUGGESTED_VALUES:0\" ${MACOS_SDK_ROOT}/SDKSettings.plist
91-
failed with the following status : ${_POLLY_PROCESS_RESULT2}
92-
")
77+
if(NOT OSX_DEPLOYMENT_SDK_VERSION)
78+
execute_process(
79+
COMMAND
80+
"/usr/libexec/PlistBuddy"
81+
-c "print 'DefaultProperties':DEPLOYMENT_TARGET_SUGGESTED_VALUES:0"
82+
${MACOS_SDK_ROOT}/SDKSettings.plist
83+
RESULT_VARIABLE _POLLY_PROCESS_RESULT2
84+
OUTPUT_VARIABLE OSX_DEPLOYMENT_SDK_VERSION
85+
OUTPUT_STRIP_TRAILING_WHITESPACE
86+
ERROR_STRIP_TRAILING_WHITESPACE
87+
)
88+
if(NOT "${_POLLY_PROCESS_RESULT2}" EQUAL "0")
89+
polly_fatal_error("Could not read the minimum suggested Deployment macOS SDK version ().
90+
The command
91+
/usr/libexec/PlistBuddy -c \"print 'DefaultProperties':DEPLOYMENT_TARGET_SUGGESTED_VALUES:0\" ${MACOS_SDK_ROOT}/SDKSettings.plist
92+
failed with the following status : ${_POLLY_PROCESS_RESULT2}
93+
")
94+
endif()
9395
endif()
9496
polly_status_debug("OSX_DEPLOYMENT_SDK_VERSION=${OSX_DEPLOYMENT_SDK_VERSION}")

0 commit comments

Comments
 (0)