Skip to content

Commit

Permalink
Fix setting of CMAKE_SYSTEM_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
EduMenges committed Jun 20, 2024
1 parent a52c591 commit af7ec62
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions ios.toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -724,18 +724,24 @@ endforeach()
# CMake 3.14+ support building for iOS, watchOS, and tvOS out of the box.
if(MODERN_CMAKE)
if(SDK_NAME MATCHES "iphone")
set(CMAKE_SYSTEM_NAME iOS)
set(TOOLCHAIN_SYSTEM_NAME iOS)
elseif(SDK_NAME MATCHES "xros")
set(CMAKE_SYSTEM_NAME visionOS)
set(TOOLCHAIN_SYSTEM_NAME visionOS)
elseif(SDK_NAME MATCHES "xrsimulator")
set(CMAKE_SYSTEM_NAME visionOS)
set(TOOLCHAIN_SYSTEM_NAME visionOS)
elseif(SDK_NAME MATCHES "macosx")
set(CMAKE_SYSTEM_NAME Darwin)
set(TOOLCHAIN_SYSTEM_NAME Darwin)
elseif(SDK_NAME MATCHES "appletv")
set(CMAKE_SYSTEM_NAME tvOS)
set(TOOLCHAIN_SYSTEM_NAME tvOS)
elseif(SDK_NAME MATCHES "watch")
set(CMAKE_SYSTEM_NAME watchOS)
set(TOOLCHAIN_SYSTEM_NAME watchOS)
endif()

# This is done because simply setting CMAKE_SYSTEM_NAME already enables CMAKE_CROSSCOMPILING, which is undesirable when building on mac for mac.
if(NOT ${CMAKE_HOST_SYSTEM_NAME} STREQUAL ${TOOLCHAIN_SYSTEM_NAME})
set(CMAKE_SYSTEM_NAME ${TOOLCHAIN_SYSTEM_NAME})
endif()

# Provide flags for a combined FAT library build on newer CMake versions
if(PLATFORM_INT MATCHES ".*COMBINED")
set(CMAKE_IOS_INSTALL_COMBINED YES)
Expand Down

0 comments on commit af7ec62

Please # to comment.