Skip to content

Commit

Permalink
[build] Fixed compile issues and warnings for iOS platform (#2852).
Browse files Browse the repository at this point in the history
Fixed cmake policy CMP0153 issue: exec_program is deprecated since version 3.0, CMake >= 3.28 prefer that this command never be called and the NEW behavior for this policy is to issue a FATAL_ERROR when the command is called.
Fixed cmake policy CMP0054 issue, Only interpret if() arguments as variables or keywords when unquoted
Update .gitignore: ignore files generated by clion and cmake.
CMake VERSION_GREATER_EQUAL comparator is not supported on version less than 3.7.
  • Loading branch information
kgbook authored Jan 12, 2024
1 parent bff0712 commit 686d958
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ vcpkg/

# LSP
compile_commands.json

# ignore files generated by clion and cmake
.idea/
cmake-build-debug/
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ else()
project(SRT VERSION ${SRT_VERSION} LANGUAGES C CXX)
endif()

if (NOT ${CMAKE_VERSION} VERSION_LESS "3.28.1")
cmake_policy(SET CMP0054 NEW)
endif ()

include(FindPkgConfig)
# XXX See 'if (MINGW)' condition below, may need fixing.
include(FindThreads)
Expand Down
7 changes: 5 additions & 2 deletions scripts/iOS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ set (CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment
# Determine the cmake host system version so we know where to find the iOS SDKs
find_program (CMAKE_UNAME uname /bin /usr/bin /usr/local/bin)
if (CMAKE_UNAME)
exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
execute_process(COMMAND uname -r
OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
string (REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
endif (CMAKE_UNAME)

Expand Down Expand Up @@ -119,7 +120,9 @@ endif (${IOS_PLATFORM} STREQUAL OS)

# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
if (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
exec_program(/usr/bin/xcode-select ARGS -print-path OUTPUT_VARIABLE CMAKE_XCODE_DEVELOPER_DIR)
execute_process(COMMAND /usr/bin/xcode-select -print-path
OUTPUT_VARIABLE CMAKE_XCODE_DEVELOPER_DIR)
string(STRIP "${CMAKE_XCODE_DEVELOPER_DIR}" CMAKE_XCODE_DEVELOPER_DIR) # FIXED: remove new line character, otherwise it complain no iOS SDK's found in default search path
set (CMAKE_IOS_DEVELOPER_ROOT "${CMAKE_XCODE_DEVELOPER_DIR}/Platforms/${IOS_PLATFORM_LOCATION}/Developer")
endif (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
set (CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
Expand Down

0 comments on commit 686d958

Please sign in to comment.