Skip to content

Catalyst - XCode 13.3 - clang: invalid version number in -target x86_64-apple-ios13.0-macabi #140

@KiruyaMomochi

Description

@KiruyaMomochi

Describe the bug
Using XCode 13.3 and building for Catalyst, default deployment target will make clang raise an error.

To Reproduce
Steps to reproduce the behavior:

  1. Use XCode 13.3
  2. Build something with platform MAC_CATALYST
  3. Build fails, with error
    FAILED: CMakeFiles/cmTC_48a6c.dir/testCCompiler.c.o
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang --target=x86_64-apple-ios13.0-macabi   -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/iOSSupport/usr/include -iframework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/iOSSupport/System/Library/Frameworks -target x86_64-apple-ios13.0-macabi   -fobjc-abi-version=2 -fobjc-arc   -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -MD -MT CMakeFiles/cmTC_48a6c.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_48a6c.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_48a6c.dir/testCCompiler.c.o -c /Users/canarypwn/Desktop/Kyaru/Texture2DDecoder/build/apple-MAC_CATALYST/CMakeFiles/CMakeTmp/testCCompiler.c
    clang: error: invalid version number in '-target x86_64-apple-ios13.0-macabi'

Expected behavior
It builds successfully.

Environment

xcode version

Xcode 13.3
Build version 13E113

clang version

Apple clang version 13.1.6 (clang-1316.0.21.2)
Target: x86_64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
  • What version of CMake did you run?
cmake version 3.23.0
  • Your faulty CMakeLists.txt here:
cmake_minimum_required(VERSION 3.13)

project(Texture2DDecoderNative)
set(CMAKE_CXX_STANDARD 17)

add_compile_definitions(_T2D_DLL)

# https://cmake.org/cmake/help/latest/guide/tutorial/Selecting%20Static%20or%20Shared%20Libraries.html
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)

add_library(Texture2DDecoderNative
            astc.cpp
            atc.cpp
            bcn.cpp
            crunch.cpp
            dllmain.cpp
            etc.cpp
            pvrtc.cpp
            unitycrunch.cpp)

# Important: If compiling with gcc, be sure strict aliasing is disabled: -fno-strict-aliasing
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    set_target_properties(Texture2DDecoderNative PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -fno-strict-aliasing")
endif()

target_include_directories(Texture2DDecoderNative PRIVATE ${PROJECT_SOURCE_DIR})
install(TARGETS Texture2DDecoderNative DESTINATION ${CMAKE_INSTALL_LIBDIR})

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions