Giter VIP home page Giter VIP logo

ios-cmake's People

Contributors

3d4m-volodymyr avatar 4brunu avatar a4z avatar blackclaws avatar caobug avatar chlandsi avatar daydreamcoding avatar dctrnoob avatar ddovod avatar ealeksandrov avatar ericoporto avatar floriandenis avatar garryyan avatar georgemp avatar greenrobot avatar jhakulin avatar jonasvautherin avatar kemchenj avatar kosyak avatar lalomartins avatar leetal avatar luncliff avatar msnexploder avatar natbro avatar neusoft-technology-solutions avatar scivision avatar simplydanny avatar spl avatar ssrobins avatar yudrb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ios-cmake's Issues

Unexpected behavior of CMAKE_FIND_ROOT_PATH_MODE_*

First, I believe the comment is wrong:

Only search the specified iOS SDK, not the remainder of the host filesystem.

That would be for ONLY, but here BOTH is set by default:

if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH CACHE STRING "" ${FORCE_CACHE})
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH CACHE STRING "" ${FORCE_CACHE})
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH CACHE STRING "" ${FORCE_CACHE})
endif()
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH CACHE STRING "" ${FORCE_CACHE})
endif()

Then, I somehow don't get the appropriate defaults. Say I create the following example:

cmake_minimum_required(VERSION 3.1)
project(CMakeFindRootPathModeExample)

message("CMAKE_FIND_ROOT_PATH_MODE_PACKAGE: ${CMAKE_FIND_ROOT_PATH_MODE_PACKAGE}")
message("CMAKE_FIND_ROOT_PATH_MODE_PROGRAM: ${CMAKE_FIND_ROOT_PATH_MODE_PROGRAM}")
message("CMAKE_FIND_ROOT_PATH_MODE_INCLUDE: ${CMAKE_FIND_ROOT_PATH_MODE_INCLUDE}")
message("CMAKE_FIND_ROOT_PATH_MODE_LIBRARY: ${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY}")

And I run it with:

cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/ios.toolchain.cmake ..

I get the following output:

CMAKE_FIND_ROOT_PATH_MODE_PACKAGE: BOTH
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM: BOTH
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE: ONLY
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY: ONLY

Even if I remove the if statements in the toolchain to always set all four to BOTH, it ends up like so.

Am I doing something wrong?

Language dialect

I can not force toolchain to specify c++ standard
adding -std=c++17
or setting set(CMAKE_CXX_STANDARD 17)
is overriden by something as in generated ninja files FLAGS is appended -std=gnu++1z
as last switch, so it overrides my settings, and is not present during configuration in CMAKE_CXX_FLAGS*

when i generate for Xcode
in project settings I see that is compiler default.
Do You have idea how to fix this

cat ../CMakeLists.txt 
cmake_minimum_required(VERSION 3.14)

PROJECT(TESTPRJ )
set(CMAKE_CXX_STANDARD 17 )
set(CMAKE_CXX_STANDARD_REQUIRED 17 )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
add_library(test main.cc)

cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake .. -DPLATFORM=OS64

ninja -v
[1/2] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++  
 -miphoneos-version-min=9.0 -fembed-bitcode -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc -miphoneos-version-min=9.0 -fembed-bitcode -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc
 -std=c++17 -miphoneos-version-min=9.0 -fembed-bitcode -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc -miphoneos-version-min=9.0 -fembed-bitcode -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc  -DNDEBUG -O3 -ffast-math -miphoneos-version-min=9.0 -fembed-bitcode -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc  -DNDEBUG -O3 -ffast-math  -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.1.sdk -miphoneos-version-min=9.0
  -std=gnu++1z -MD -MT CMakeFiles/test.dir/main.cc.o -MF CMakeFiles/test.dir/main.cc.o.d -o CMakeFiles/test.dir/main.cc.o -c ../main.cc

iphoneos is not an iOS SDK

Building example-lib get an error:

CMake Error at /usr/local/Cellar/cmake/3.14.5/share/cmake/Modules/Platform/iOS-Initialize.cmake:4 (message):
  iphoneos is not an iOS SDK
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.14.5/share/cmake/Modules/CMakeSystemSpecificInitialize.cmake:21 (include)
  CMakeLists.txt:2 (project)

use cmake 3.15.rc not working.
can some one help me?

cmake build failed using Xcode 11

It always works when using Xcode10, however when update Xcode to 11.2, cmake build failed.

CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Building with Xcode version: 11.2.1
-- Configuring iOS build for platform: OS, architecture(s): armv7;armv7s;arm64;arm64e
-- Using manually set SDK path: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk for platform: OS
-- Using C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Using CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- Using libtool: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- Using a data_ptr size of 4
-- Building for minimum iOS version: 9.0 (SDK version: 13.2)
-- Version flags set to: -miphoneos-version-min=9.0
-- Disabling bitcode support.
-- Enabling ARC support.
-- Hiding symbols (-fvisibility=hidden).
CMake Warning (dev) at ios.toolchain.cmake:452 (set):
  implicitly converting 'string' to 'STRING' type.
Call Stack (most recent call first):
  /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/3.15.4/CMakeSystem.cmake:6 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
CMake Warning (dev) at /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/ios-cmake/ios.toolchain.cmake:452 (set):
  implicitly converting 'string' to 'STRING' type.
Call Stack (most recent call first):
  /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/3.15.4/CMakeSystem.cmake:6 (include)
  /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- broken
CMake Error at /usr/local/Cellar/cmake/3.15.4/share/cmake/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/xcodebuild -project CMAKE_TRY_COMPILE.xcodeproj build -target cmTC_0c8e5 -configuration Debug -hideShellScriptEnvironment && User defaults from command line:
        HideShellScriptEnvironment = YES

    Prepare build
    note: Using legacy build system
    === BUILD TARGET cmTC_0c8e5 OF PROJECT CMAKE_TRY_COMPILE WITH CONFIGURATION Debug ===

    Check dependencies
    warning: The armv7 architecture is deprecated for your deployment target (iOS 13.2). You should update your ARCHS build setting to remove the armv7 architecture.
    warning: The armv7s architecture is deprecated for your deployment target (iOS 13.2). You should update your ARCHS build setting to remove the armv7s architecture.

    Write auxiliary files
    /bin/mkdir -p /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/armv7
    write-file /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/armv7/cmTC_0c8e5.LinkFileList
    /bin/mkdir -p /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/arm64e
    write-file /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/arm64e/cmTC_0c8e5.LinkFileList
    /bin/mkdir -p /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/armv7s
    write-file /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/armv7s/cmTC_0c8e5.LinkFileList
    /bin/mkdir -p /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/arm64
    write-file /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/arm64/cmTC_0c8e5.LinkFileList

    CompileC CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/arm64/testCCompiler.o testCCompiler.c normal arm64 c com.apple.compilers.llvm.clang.1_0.compiler
        cd /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target arm64-apple-ios13.2 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DCMAKE_INTDIR=\"Debug-iphoneos\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -fembed-bitcode-marker -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/Debug/include -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/DerivedSources-normal/arm64 -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/DerivedSources/arm64 -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/Debug -miphoneos-version-min=9.0 -fobjc-abi-version=2 -fobjc-arc -miphoneos-version-min=9.0 -fobjc-abi-version=2 -fobjc-arc -MMD -MT dependencies -MF /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/arm64/testCCompiler.d --serialize-diagnostics /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/arm64/testCCompiler.dia -c /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/testCCompiler.c -o /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/arm64/testCCompiler.o
    clang: warning: overriding '-miphoneos-version-min=9.0' option with '--target=arm64-apple-ios13.2' [-Woverriding-t-option]

    CompileC CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/armv7s/testCCompiler.o testCCompiler.c normal armv7s c com.apple.compilers.llvm.clang.1_0.compiler
        cd /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target armv7s-apple-ios13.2 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DCMAKE_INTDIR=\"Debug-iphoneos\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -fembed-bitcode-marker -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/Debug/include -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/DerivedSources-normal/armv7s -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/DerivedSources/armv7s -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/Debug -miphoneos-version-min=9.0 -fobjc-abi-version=2 -fobjc-arc -miphoneos-version-min=9.0 -fobjc-abi-version=2 -fobjc-arc -MMD -MT dependencies -MF /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/armv7s/testCCompiler.d --serialize-diagnostics /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/armv7s/testCCompiler.dia -c /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/testCCompiler.c -o /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/armv7s/testCCompiler.o
    clang: warning: overriding '-miphoneos-version-min=9.0' option with '--target=armv7s-apple-ios13.2' [-Woverriding-t-option]
    clang: error: invalid iOS deployment version '--target=armv7s-apple-ios13.2', iOS 10 is the maximum deployment target for 32-bit targets [-Winvalid-ios-deployment-target]

    CompileC CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/arm64e/testCCompiler.o testCCompiler.c normal arm64e c com.apple.compilers.llvm.clang.1_0.compiler
        cd /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target arm64e-apple-ios13.2 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DCMAKE_INTDIR=\"Debug-iphoneos\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -fembed-bitcode-marker -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/Debug/include -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/DerivedSources-normal/arm64e -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/DerivedSources/arm64e -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/Debug -miphoneos-version-min=9.0 -fobjc-abi-version=2 -fobjc-arc -miphoneos-version-min=9.0 -fobjc-abi-version=2 -fobjc-arc -MMD -MT dependencies -MF /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/arm64e/testCCompiler.d --serialize-diagnostics /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/arm64e/testCCompiler.dia -c /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/testCCompiler.c -o /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/arm64e/testCCompiler.o
    clang: warning: overriding '-miphoneos-version-min=9.0' option with '--target=arm64e-apple-ios13.2' [-Woverriding-t-option]

    CompileC CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/armv7/testCCompiler.o testCCompiler.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
        cd /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target armv7-apple-ios13.2 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DCMAKE_INTDIR=\"Debug-iphoneos\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -fstrict-aliasing -Wdeprecated-declarations -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -fembed-bitcode-marker -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/Debug/include -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/DerivedSources-normal/armv7 -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/DerivedSources/armv7 -I/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/Debug -miphoneos-version-min=9.0 -fobjc-abi-version=2 -fobjc-arc -miphoneos-version-min=9.0 -fobjc-abi-version=2 -fobjc-arc -MMD -MT dependencies -MF /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/armv7/testCCompiler.d --serialize-diagnostics /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/armv7/testCCompiler.dia -c /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/testCCompiler.c -o /Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/armv7/testCCompiler.o
    clang: warning: overriding '-miphoneos-version-min=9.0' option with '--target=armv7-apple-ios13.2' [-Woverriding-t-option]
    clang: error: invalid iOS deployment version '--target=armv7-apple-ios13.2', iOS 10 is the maximum deployment target for 32-bit targets [-Winvalid-ios-deployment-target]

    ** BUILD FAILED **


    The following build commands failed:
    	CompileC CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/armv7s/testCCompiler.o testCCompiler.c normal armv7s c com.apple.compilers.llvm.clang.1_0.compiler
    	CompileC CMAKE_TRY_COMPILE.build/Debug-iphoneos/cmTC_0c8e5.build/Objects-normal/armv7/testCCompiler.o testCCompiler.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
    (2 failures)





  CMake will not be able to correctly generate this project.


-- Configuring incomplete, errors occurred!
See also "/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeOutput.log".
See also "/Users/xmly/Desktop/xiaoyaOS/LinuxNano/build-ios/XYOSClientSDK/build-cache/CMakeFiles/CMakeError.log".

dyld: Library not loaded Reason: image not found

I have built a .dylib using this toolchain and I have been using it to great success in an Xcode project that referenced it directly using the following steps:

  1. Add the file to Linked Frameworks and Libraries
  2. Drag the .dylib from the Frameworks folder in the side panel to the Embedded Binaries section
  3. Add Header/Library/Framework Search paths so that everything is found

However, I have found that if I copy the file anywhere else and then try to follow the above steps with the file in the new location, I suddenly get the following error:

dyld: Library not loaded: @rpath/libmyLib.dylib
  Referenced from: ~/Library/Developer/CoreSimulator/Devices/A234D1DD-FDA8-4E57-A8A3-A1EC6917DD46/data/Containers/Bundle/Application/C7750319-CDBB-49AF-AD5D-3944D4B6D01D/myApp.app/myApp
  Reason: image not found

Specifically, the dylib that I'm using is in build-folder/Debug-iphonesimulator. I wondered if there were some other files it was referencing, but I deleted all the other files in that directory and it still worked (until I copied it elsewhere). Do I need to be including other files in my XCode project? It is very important that I be able to move the .dylib because I need to be able to send it to others without them rebuilding the source on their machine.

Thank you for your time and please let me know if you need more details or a sample project.

Build fails with SIMULATOR and default parameters

Building google protocol buffers with the following command fails:

cmake -DCMAKE_TOOLCHAIN_FILE=./ios-cmake/ios.toolchain.cmake -DIOS_PLATFORM=SIMULATOR -DCMAKE_INSTALL_PREFIX=./dependencies -Dprotobuf_BUILD_TESTS=OFF -H./protobuf/cmake -B./protobuf/.build

The following error occurs:

[ 40%] Linking CXX executable js_embed
/usr/local/Cellar/cmake/3.10.2/bin/cmake -E cmake_link_script CMakeFiles/js_embed.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++  -mios-simulator-version-min=8.0 -fembed-bitcode-marker -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc  -g -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.2.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/js_embed.dir/protobuf/src/google/protobuf/compiler/js/embed.cc.o  -o js_embed
ld: warning: -headerpad_max_install_names is ignored when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES)
ld: '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a(arclite.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a' for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [js_embed] Error 1
make[1]: *** [CMakeFiles/js_embed.dir/all] Error 2
make: *** [all] Error 2

It seems that ARC and bitcode are incompatible with SIMULATOR build:

for file in $(ls /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc); do echo $file; otool -l $file| grep __LLVM | uniq;done

libarclite_appletvos.a
   segname __LLVM
libarclite_appletvsimulator.a
libarclite_iphoneos.a
   segname __LLVM
libarclite_iphonesimulator.a
libarclite_macosx.a
libarclite_watchos.a
   segname __LLVM
libarclite_watchsimulator.a
   segname __LLVM

Add Catalyst support (UIKit on macOS)

This seems possible via -target x86_64-apple-ios-macabi -miphoneos-version-min=13.0. Adding it to CFLAGS and LDFLAGS should be sufficient, although untested.

Cannot specify a custom toolchain

Hello!

I installed a custom LLVM6.0.1.xctoolchain to the /Library/Developer/Toolchains directory. In order to modify the xocde default toolchain in cmake, I added the following options to the cmake file.

set(CMAKE_C_COMPILER /Library/Developer/Toolchains/LLVM6.0.1.xctoolchain/usr/bin/clang)
set(CMAKE_CXX_COMPILER /Library/Developer/Toolchains/LLVM6.0.1.xctoolchain/usr/bin/clang++)

But the xcode project generated by cmake still uses the default compiler.

Cmake output log:

-- The C compiler identification is AppleClang 10.0.0.10001145
-- The CXX compiler identification is AppleClang 10.0.0.10001145
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- works
-- Detecting C compiler ABI info

How to replace XcodeDefault.xctoolchain with LLVM6.0.1.xctoolchain with cmake command? Look forward to your favourable reply.

CMAKE_TRY_COMPILE_TARGET_TYPE has an open bug in CMake

As reported here:

Setting CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY will subvert the behaviour of the CHECK_FUNCTION_EXISTS macro, causing it to always return true/success (as it will never attempt the link step that is intended to confirm the function availability).

The consequence of that is that some cmake code like:

include(CheckLibraryExists)

check_library_exists("some_nonexisting_foo_lib" foo_symbol "${CMAKE_LIBRARY_PATH}" HAVE_FOO)

will always set HAVE_FOO to True. In my case, it is an issue with Curl, which tests for idn2 and compiles accordingly.

Is there a reason for setting CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY in your toolchain? The comment reads: "Change the type of target generated for try_compile() so it'll work when cross-compiling". In my case, removing this line just works to build my project.

Maybe this flag is needed generally, and I should just remove it in my project until the bug is fixed on CMake side, but I wanted to keep a record of that and know if it is really necessary.

rebuild with platform OS64COMBINED

When building my project as follows :

cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../cfg/ios.toolchain.cmake -DPLATFORM=OS64COMBINED

cmake --build . --config Debug --target install

everything works fine. But if I change any source and recompile by calling

cmake --build . --config Debug --target install

the compilation itself succeeds. But when it comes to creating the fat libs it bails out with the following error :

  Output:

  fatal error:
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo:
  input file
  (/Users/yenzi/Projects/myProj/build-ios/deploy/lib/libawlog.a)
  must be a fat file when the -remove option is specified
Call Stack (most recent call first):
  /opt/local/share/cmake-3.14/Modules/CMakeIOSInstallCombined.cmake:164 (_ios_install_combined_remove_arch)
  /opt/local/share/cmake-3.14/Modules/CMakeIOSInstallCombined.cmake:292 (_ios_install_combined_keep_archs)
  cmn/internal/logger/cpp/cmake_install.cmake:49 (ios_install_combined)
  cmake_install.cmake:38 (include)

Any idea how this can be fixed ?

Contribute to CMake's first-class iOS, tvOS, and watchOS support

Was looking at your toolchain which was really helpful, but I did hit some issues with recent CMake versions. After more digging, I found out that CMake 3.14 has first-class support for iOS etc:

It leverages the CMAKE_SYSTEM_NAME variable which is consistent with doing cross-platform in general on CMake, which is quite nice.

It might be interesting to try to consolidate your work with what @gjasny contributed in CMake?

Best

Recent addition of CMAKE_SYSTEM_PROCESSOR breaks some build

It seems to me that the recent addition (solving #40) of CMAKE_SYSTEM_PROCESSOR breaks some build.

I am not sure why, so here is a reproducible example:

  1. Use the latest ios.toolchain.cmake file
  2. Use the following CMakeLists.txt, which will basically download and build libressl
  3. Run cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/ios.toolchain.cmake ..

CMakeLists.txt

cmake_minimum_required(VERSION 3.1)
  
project(external-libressl)
include(ExternalProject)

set(LIBRESSL_VERSION 2.9.0)

list(APPEND CMAKE_ARGS
    "-DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}"
    "-DBUILD_SHARED_LIBS=OFF"
    "-DLIBRESSL_APPS=OFF"
    "-DLIBRESSL_TESTS=OFF"
    )

if(IOS)
    list(APPEND CMAKE_ARGS
        "-DPLATFORM=${PLATFORM}"
        "-DCMAKE_C_FLAGS=-Wno-implicit-function-declaration"
        )
endif()

message(STATUS "Preparing external project \"libressl\" with args:")
foreach(CMAKE_ARG ${CMAKE_ARGS})
    message(STATUS "-- ${CMAKE_ARG}")
endforeach()

ExternalProject_add(
    libressl
    URL https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${LIBRESSL_VERSION}.tar.gz
    PREFIX libressl
    CMAKE_ARGS "${CMAKE_ARGS}"
    )

The error I get:

[ 75%] Performing build step for 'libressl'
Scanning dependencies of target crypto
[  0%] Building C object crypto/CMakeFiles/crypto.dir/aes/aes-elf-armv4.S.o
/tmp/demo_libressl/build/libressl/src/libressl/crypto/aes/aes-elf-armv4.S:1:10: fatal error: 'arm_arch.h' file not found
#include "arm_arch.h"
         ^~~~~~~~~~~~

Removing this addition of CMAKE_SYSTEM_PROCESSOR fixes it, I have no idea why.

Error "invalid argument '-mmacosx-version-min=9.0'"

I'm using CMake with ios-cmake (3.1.0) inside an Xcode Run Script build phase, to build a 3rd party static library my target links with. However, Clang immediately fails with:

clang: error: invalid argument '-mmacosx-version-min=9.0' not allowed with '-mios-simulator-version-min=9.0'

The problem appears to be caused by this statement in ios.toolchain.cmake:

set(CMAKE_OSX_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET} CACHE STRING
"Set CMake deployment target" ${FORCE_CACHE})

If I comment out those two lines, everything builds fine. It seems wrong for the script to be forcing a macOS deployment target when it's not building for macOS, but somehow I'm the only one having trouble as a result...

Here's the full CMake output:

CMake options:                  -DCMAKE_TOOLCHAIN_FILE=vendor/ios-cmake/ios.toolchain.cmake                 -DPLATFORM=SIMULATOR64             -DENABLE_PROGRAMS=0             -DENABLE_TESTING=0 -DCMAKE_BUILD_TYPE=Debug -DLWS_WITH_ASAN=1
-- Building with Xcode version: 11.2.1
-- Configuring iphonesimulator build for platform: SIMULATOR64, architecture(s): x86_64
-- Using SDK: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk for platform: SIMULATOR64
-- Using the default min-version since DEPLOYMENT_TARGET not provided!
-- Disabling bitcode support by default on simulators. ENABLE_BITCODE not provided for override!
-- Enabling ARC support by default. ENABLE_ARC not provided!
-- Hiding symbols visibility by default. ENABLE_VISIBILITY not provided!
-- Using NON-strict compiler checks by default. ENABLE_STRICT_TRY_COMPILE not provided!
-- Using C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Using CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- Using libtool: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- Using install_name_tool: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool
-- Using a data_ptr size of 8
-- Building for minimum iphonesimulator version: 9.0 (SDK version: 13.2)
-- Version flags set to: -mios-simulator-version-min=9.0
-- Disabling bitcode support.
-- Enabling ARC support.
-- Hiding symbols (-fvisibility=hidden).
-- Building with Xcode version: 11.2.1
-- Configuring iphonesimulator build for platform: SIMULATOR64, architecture(s): x86_64
-- Using SDK: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk for platform: SIMULATOR64 when checking compatibility
-- Using libtool: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- Using a data_ptr size of 8
-- Building for minimum iphonesimulator version: 9.0 (SDK version: 13.2)
-- Version flags set to: -mios-simulator-version-min=9.0
-- Disabling bitcode support.
-- Enabling ARC support.
-- Hiding symbols (-fvisibility=hidden).
-- The C compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- broken
CMake Error at /usr/local/Cellar/cmake/3.9.1/share/cmake/Modules/CMakeTestCCompiler.cmake:51 (message):
  The C compiler
  "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /Users/snej/Couchbase/CBL/couchbase-lite-ios/build/CouchbaseLite/Build/Intermediates.noindex/LiteCore.build/Debug-iphonesimulator/mbedTLS.build/Objects/mbedtls/CMakeFiles/CMakeTmp

  

  Run Build Command:"/Applications/Xcode.app/Contents/Developer/usr/bin/make"
  "cmTC_823d2/fast"

  /Applications/Xcode.app/Contents/Developer/usr/bin/make -f
  CMakeFiles/cmTC_823d2.dir/build.make CMakeFiles/cmTC_823d2.dir/build

  Building C object CMakeFiles/cmTC_823d2.dir/testCCompiler.c.o

  
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
  -mios-simulator-version-min=9.0 -fobjc-abi-version=2 -fobjc-arc
  -mios-simulator-version-min=9.0 -fobjc-abi-version=2 -fobjc-arc -arch
  x86_64 -isysroot
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk
  -mmacosx-version-min=9.0 -o CMakeFiles/cmTC_823d2.dir/testCCompiler.c.o -c
  /Users/snej/Couchbase/CBL/couchbase-lite-ios/build/CouchbaseLite/Build/Intermediates.noindex/LiteCore.build/Debug-iphonesimulator/mbedTLS.build/Objects/mbedtls/CMakeFiles/CMakeTmp/testCCompiler.c


  clang: error: invalid argument '-mmacosx-version-min=9.0' not allowed with
  '-mios-simulator-version-min=9.0'

How to specify Debug/Release mode?

I have tried -DCMAKE_BUILD_TYPE=Release but I get:

CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_BUILD_TYPE

Any help is appreciated.

Specifically, the command I am using is

cmake -G Xcode -Bios-build/SIMULATOR64 \
            -Hios-resources \
            -DCMAKE_TOOLCHAIN_FILE=${IOS_TOOLCHAIN} \
            -DIOS_PLATFORM=SIMULATOR64 \
            -DCMAKE_CXX_STANDARD=11 \
            -DCMAKE_BUILD_TYPE=Release

cd ios-build/SIMULATOR64
cmake --build .

I have also tried the following:

cmake -G Xcode -Bios-build/SIMULATOR64 \
            -Hios-resources \
            -DCMAKE_TOOLCHAIN_FILE=${IOS_TOOLCHAIN} \
            -DIOS_PLATFORM=SIMULATOR64 \
            -DCMAKE_CXX_STANDARD=11

cd ios-build/SIMULATOR64
cmake -DCMAKE_BUILD_TYPE=Release --build .

With the same result.

It is important to me that I be able to completely build the framework from the command line so that I can automate the process.

Thank you for any help you can provide.

-fvisibility=hidden causes build error

I had a very simple CMakeLists.txt:

`cmake_minimum_required (VERSION 3.9)

project (testcm)

include_directories(
"${PROJECT_BINARY_DIR}"
include)

add_library(func
SHARED
func/func.cpp)

add_executable(testcm main/main.cpp)

target_link_libraries(testcm func)`

And after cmake -DCMAKE_TOOLCHAIN_FILE=ios.toolchain.cmake -DIOS_PLATFORM=OS .. & make, I got this
Undefined symbols for architecture armv7: "_func1", referenced from: _main in main.cpp.o ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)
And after removing -fvisibility=hidden from CXXFLAGS set in ios.toolchain.cmake, it works.

Invalid iOS deployment version

Hi, I tried to get your iOS CMake Toolchain running but I always get the same error:

clang: error: invalid iOS deployment version '-mios-simulator-version-min=12.1',
iOS 10 is the maximum deployment target for 32-bit targets
[-Winvalid-ios-deployment-target]

I know 32-bit targets are no longer supported, but I don't understand why the CMake build always sets this target (i.e. i386). No matter if I set IOS_PLATFORM macro to OS or SIMULATOR64.

I also tried different deployment targets: 8.0, 10.0, 12.0, and 12.1.
But since SDK 12.1 is my only installed SDK, the CMake build can only use this one.

Can anyone tell me what I'm doing wrong?

target specifies product type 'com.apple.product-type.tool', but there's no such product type for the 'iphoneos' platform

When I execute this command, an error is reported.How to solve this problem?
cmake --build . --config Release --target install

ERROR:

=== BUILD TARGET cmTC_1f537 OF PROJECT CMAKE_TRY_COMPILE WITH CONFIGURATION Debug ===

Check dependencies
target specifies product type 'com.apple.product-type.tool', but there's no such product type for the 'iphoneos' platform

** BUILD FAILED **

Problems with simple C++ sample and your toolkit (FAT/COMBINED)

Hi,

First, you make a great toolkit, good job!

Second, im trying use your toolkit to build a simple FAT/COMBINED library and use on xcode.

The problem is that generated library is only with one "arch".

There is a test on my sample repository, and the problem can be checked there:
https://travis-ci.com/prsolucoes/ios-lib-test/builds/138626985#L873

Im calling your toolkit with the params:
https://github.com/prsolucoes/ios-lib-test/blob/master/Makefile#L24

It is strange, because if i run install it generate the library into system folder with all archs inside:
/usr/local/lib/libcpp_lib_test.a

The command to install is here:
https://github.com/prsolucoes/ios-lib-test/blob/master/Makefile#L40

Can you help me understand the problem?

Thanks.

Not build from XCode 11.3 (11C29)

-- Merging integrated CMake 3.14+ iOS,tvOS,watchOS,macOS toolchain(s) with this toolchain!
-- Building with Xcode version:
-- Configuring iphoneos build for platform: OS, architecture(s): armv7;armv7s;arm64
-- Using SDK: for platform: OS
-- Using the default min-version since DEPLOYMENT_TARGET not provided!
-- Enabling bitcode support by default. ENABLE_BITCODE not provided!
-- Enabling ARC support by default. ENABLE_ARC not provided!
-- Hiding symbols visibility by default. ENABLE_VISIBILITY not provided!
-- Using NON-strict compiler checks by default. ENABLE_STRICT_TRY_COMPILE not provided!
CMake Error at toolchain/ios.toolchain.cmake:395 (get_filename_component):
get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
/usr/local/share/cmake-3.16/Modules/CMakeDetermineSystem.cmake:90 (include)
CMakeLists.txt:4 (project)

CMake Error at toolchain/ios.toolchain.cmake:396 (get_filename_component):
get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
/usr/local/share/cmake-3.16/Modules/CMakeDetermineSystem.cmake:90 (include)
CMakeLists.txt:4 (project)

CMake Error at toolchain/ios.toolchain.cmake:399 (message):
Invalid CMAKE_DEVELOPER_ROOT: does not exist.
Call Stack (most recent call first):
/usr/local/share/cmake-3.16/Modules/CMakeDetermineSystem.cmake:90 (include)
CMakeLists.txt:4 (project)

CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
make: *** No targets specified and no makefile found. Stop.

On previous version XCode - build is ok. How to fix it?

Compiler detection issue

Hello!

When building QXmpp and my Qt application with ios-cmake, I get this error:

CMake Error in src/CMakeLists.txt:
No known features for CXX compiler
"AppleClang"
version 10.0.0.10001145. 

How can I troubleshoot?

find_host_package CMAKE_FIND_ROOT_PATH_MODE_PACKAGE?

I see that the find_host_package macro sets CMAKE_FIND_ROOT_PATH_MODE_PROGRAM, CMAKE_FIND_ROOT_PATH_MODE_LIBRARY & CMAKE_FIND_ROOT_PATH_MODE_INCLUDE to NEVER before forwarding the call to find_package. This all looks reasonable, but there's also a similar CMAKE_FIND_ROOT_PATH_MODE_PACKAGE variable that is not touched.

Any specific reason for find_host_package not doing the same also for CMAKE_FIND_ROOT_PATH_MODE_PACKAGE?

CMAKE_STRIP variable

Please insert this code too: set(CMAKE_STRIP strip CACHE FILEPATH "" FORCE),
also will be useful setup CMAKE_SYSTEM_PROCESSOR variable:

if(ARCHS MATCHES "((^|, )(arm64|arm64e|x86_64))+")
  set(CMAKE_C_SIZEOF_DATA_PTR 8)
  set(CMAKE_CXX_SIZEOF_DATA_PTR 8)
  if(ARCHS MATCHES "((^|, )(arm64|arm64e))+")
    set(CMAKE_SYSTEM_PROCESSOR "arm64")
  else()
    set(CMAKE_SYSTEM_PROCESSOR "x86_64")
  endif()
  message(STATUS "Using a data_ptr size of 8")
else()
  set(CMAKE_C_SIZEOF_DATA_PTR 4)
  set(CMAKE_CXX_SIZEOF_DATA_PTR 4)
  set(CMAKE_SYSTEM_PROCESSOR "arm")
  message(STATUS "Using a data_ptr size of 4")
endif()

Thank you for your work!

cmake error

there is an error occur when i build the google test and avs-device-sdk

I enter the command on the command line:
cmake ../googletest -DIOS_DEPLOYMENT_TARGET=10.0 -DCMAKE_TOOLCHAIN_FILE=../ios-cmake/ios.toolchain.cmake -DIOS_PLATFORM=OS
or
cmake ../avs-device-sdk -DIOS_DEPLOYMENT_TARGET=10.0 -DCMAKE_TOOLCHAIN_FILE=../ios-cmake/ios.toolchain.cmake -DIOS_PLATFORM=OS -DGSTREAMER_MEDIA_PLAYER=OFF -DCURL_LIBRARY=../Build-OpenSSL-cURL/archive/libcurl-7.54.1-openssl-1.0.2l-nghttp2-1.24.0/libcurl_iOS.a -DCURL_INCLUDE_DIR=../Build-OpenSSL-cURL/curl/curl-7.55.1/include -DGTEST_LIBRARY=../googletest_build/googlemock/libgmock.a -DGTEST_MAIN_LIBRARY=../googletest_build/googlemock/libgmock_main.a -DGTEST_INCLUDE_DIR=../googletest/googletest/include/ -DPKG_CONFIG_EXECUTABLE=/usr/local/bin/pkg-config

error is:

-- Building with Xcode version:
-- Configuring iOS build for platform: SIMULATOR64, architecture(s): x86_64
-- Using SDK: for platform: SIMULATOR64
CMake Error at ../ios-cmake/ios.toolchain.cmake:172 (message):
Invalid CMAKE_OSX_SYSROOT: does not exist.
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.11.3/share/cmake/Modules/CMakeDetermineSystem.cmake:94 (include)
CMakeLists.txt:4 (project)

CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

How can I build it successfully?

Could NOT find Git (missing: GIT_EXECUTABLE)

Because the line https://github.com/leetal/ios-cmake/blob/master/ios.toolchain.cmake#L411 sets CMAKE_FIND_ROOT_PATH_MODE_PROGRAM to "ONLY" CMake no longer can locate git executable when it is required. For example if I have CMakeLists.txt that contains:

find_package(GIT REQUIRED)

CMake will generate error:

CMake Error at /Applications/CMake.app/Contents/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find Git (missing: GIT_EXECUTABLE)
Call Stack (most recent call first):
  /Applications/CMake.app/Contents/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /Applications/CMake.app/Contents/share/cmake-3.12/Modules/FindGit.cmake:83 (find_package_handle_standard_args)
  cmake-modules/Catch2.cmake:9 (find_package)
  CMakeLists.txt:56 (include)

My setup is:

cmake version 3.12.0-rc1
git version 2.17.1
Xcode 9.4 Build version 9F1027a

CMake for watchOS && wacthOS simulator generated the Wrong tvOS 8.0 min deployment target version binary

The system envionment

~ xcodebuild -version
Xcode 10.1
Build version 10B61
➜  ~ cmake --version
cmake version 3.12.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

The usage

Trying to build libde265 project:

cmake .. -DCMAKE_TOOLCHAIN_FILE=../../ios-cmake/ios.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DIOS_PLATFORM=SIMULATOR_WATCHOS
make

Result

This can build. However, the generated static library's is strange. The architecture is correct, but however, the info stored inside Mach-O binary is strange and point out it's a watchOS 8.0 (?) binary. However, current (2018) latest watchOS SDK is 5.1.

See the output (take watchOS simulator for example) :

➜  SIMULATOR_WATCHOS lipo -info libde265.a
Non-fat file: libde265.a is architecture: i386
➜  SIMULATOR_WATCHOS otool -lv libde265.a | grep platform
  platform watchos
➜  SIMULATOR_WATCHOS otool -lv libde265.a | grep minos
     minos 8.0

And also, when uploading to CocoaPods trunk, the pod spec lint show the warnings here:

    - NOTE  | [SDWebImageHEIFCoder/libde265] xcodebuild:  ld: warning: URGENT: building for watchOS simulator, but linking in object file (/Users/travis/build/SDWebImage/SDWebImageHEIFCoder/Vendors/libde265/watchOS/libde265.a(cabac.cc.o)) built for tvOS. Note: This will be an error in the future.
    - NOTE  | [SDWebImageHEIFCoder/libde265] xcodebuild:  ld: warning: object file (/Users/travis/build/SDWebImage/SDWebImageHEIFCoder/Vendors/libde265/watchOS/libde265.a(cabac.cc.o)) was built for newer tvOS version (8.0) than being linked (2.0)
    - NOTE  | [SDWebImageHEIFCoder/libde265] xcodebuild:  ld: warning: URGENT: building for watchOS simulator, but linking in object file (/Users/travis/build/SDWebImage/SDWebImageHEIFCoder/Vendors/libde265/watchOS/libde265.a(de265.cc.o)) built for tvOS. Note: This will be an error in the future.
    - NOTE  | [watchOS] [SDWebImageHEIFCoder/libx265] xcodebuild:  ld: warning: URGENT: building for watchOS simulator, but linking in object file (/Users/travis/build/SDWebImage/SDWebImageHEIFCoder/Vendors/libx265/watchOS/libx265.a(analysis.cpp.o)) built for tvOS. Note: This will be an error in the future.
    - NOTE  | [watchOS] [SDWebImageHEIFCoder/libx265] xcodebuild:  ld: warning: object file (/Users/travis/build/SDWebImage/SDWebImageHEIFCoder/Vendors/libx265/watchOS/libx265.a(analysis.cpp.o)) was built for newer tvOS version (8.0) than being linked (2.0)
    - NOTE  | [watchOS] [SDWebImageHEIFCoder/libx265] xcodebuild:  ld: warning: URGENT: building for watchOS simulator, but linking in object file (/Users/travis/build/SDWebImage/SDWebImageHEIFCoder/Vendors/libx265/watchOS/libx265.a(search.cpp.o)) built for tvOS. Note: This will be an error in the future.
    - NOTE  | [watchOS] [SDWebImageHEIFCoder/libx265] xcodebuild:  ld: warning: object file (/Users/travis/build/SDWebImage/SDWebImageHEIFCoder/Vendors/libx265/watchOS/libx265.a(search.cpp.o)) was built for newer tvOS version (8.0) than being linked (2.0)

The FAT binary is in one open-source project and you can also download it from GitHub here.

Note that pod spec lint will check all 4 Apple platforms iOS/tvOS/watchOS/macOS, thoes warnings only happend on watchOS binary.

😕 I'm wondering is this a designed behavior ? (Quite strange from the first look), or Xcode bug ? Or this ios-cmake script issue ? Thanks for support !

Overwriting CMAKE_OSX_SYSROOT with an invalid value

Here in the commit CMAKE_OSX_SYSROOT becomes like

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk

All is OK.

But here in the commit CMAKE_OSX_SYSROOT becomes like

iphonesimulator

For what purpose?

And further work is done with CMAKE_OSX_SYSROOT as a path to a file, rather than as the name of the SDK.

cmake error

cmake .. -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DIOS_PLATFORM=SIMULATOR64
CMake Error: The source directory "/Users/mr/Downloads/ios-cmake-master/example" does not appear to contain CMakeLists.txt. cd build ,cmake build error,what is happen?

TVOS with Xcode generator error

Hi,

Your example with the TVOS platform and the Xcode generator seems to produces an error :-/

Command to reproduce:

cd example/example-lib
mkdir build
cd build
cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DIOS_PLATFORM=TVOS

Stdout:

-- Building with Xcode version: 10.2
-- Configuring iOS build for platform: TVOS, architecture(s): arm64
-- Using manually set SDK path: /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.2.sdk for platform: TVOS
-- Using the default min-version since IOS_DEPLOYMENT_TARGET not provided!
-- Enabling bitcode support by default. ENABLE_BITCODE not provided!
-- Enabling ARC support by default. ENABLE_ARC not provided!
-- Hiding symbols visibility by default. ENABLE_VISIBILITY not provided!
-- Using C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Using CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- Using libtool: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- Using a data_ptr size of 8
-- Building for minimum iOS version: 8.0 (SDK version: 12.2)
-- Version flags set to: -mtvos-version-min=8.0
-- Enabling bitcode support.
-- Enabling ARC support.
-- Hiding symbols (-fvisibility=hidden).
CMake Warning (dev) at /Users/sylvain/Temp/ios-cmake/ios.toolchain.cmake:459 (set):
  implicitly converting 'string' to 'STRING' type.
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.14.0/share/cmake/Modules/CMakeDetermineSystem.cmake:93 (include)
  CMakeLists.txt:2 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Building with Xcode version: 10.2
-- Configuring iOS build for platform: TVOS, architecture(s): arm64
-- Using manually set SDK path: /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.2.sdk for platform: TVOS
-- Using libtool: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- Using a data_ptr size of 8
-- Building for minimum iOS version: 8.0 (SDK version: 12.2)
-- Version flags set to: -mtvos-version-min=8.0
-- Enabling bitcode support.
-- Enabling ARC support.
-- Hiding symbols (-fvisibility=hidden).
CMake Warning (dev) at /Users/sylvain/Temp/ios-cmake/ios.toolchain.cmake:459 (set):
  implicitly converting 'string' to 'STRING' type.
Call Stack (most recent call first):
  build/CMakeFiles/3.14.0/CMakeSystem.cmake:6 (include)
  CMakeLists.txt:2 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
CMake Warning (dev) at /Users/sylvain/Temp/ios-cmake/ios.toolchain.cmake:459 (set):
  implicitly converting 'string' to 'STRING' type.
Call Stack (most recent call first):
  /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/3.14.0/CMakeSystem.cmake:6 (include)
  /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- works
-- Detecting C compiler ABI info
CMake Warning (dev) at /Users/sylvain/Temp/ios-cmake/ios.toolchain.cmake:459 (set):
  implicitly converting 'string' to 'STRING' type.
Call Stack (most recent call first):
  /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/3.14.0/CMakeSystem.cmake:6 (include)
  /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Detecting C compiler ABI info - done
-- Detecting C compile features
CMake Warning (dev) at /Users/sylvain/Temp/ios-cmake/ios.toolchain.cmake:459 (set):
  implicitly converting 'string' to 'STRING' type.
Call Stack (most recent call first):
  /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/3.14.0/CMakeSystem.cmake:6 (include)
  /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /Users/sylvain/Temp/ios-cmake/ios.toolchain.cmake:459 (set):
  implicitly converting 'string' to 'STRING' type.
Call Stack (most recent call first):
  /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/3.14.0/CMakeSystem.cmake:6 (include)
  /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /Users/sylvain/Temp/ios-cmake/ios.toolchain.cmake:459 (set):
  implicitly converting 'string' to 'STRING' type.
Call Stack (most recent call first):
  /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/3.14.0/CMakeSystem.cmake:6 (include)
  /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
CMake Warning (dev) at /Users/sylvain/Temp/ios-cmake/ios.toolchain.cmake:459 (set):
  implicitly converting 'string' to 'STRING' type.
Call Stack (most recent call first):
  /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/3.14.0/CMakeSystem.cmake:6 (include)
  /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -- broken
CMake Error at /usr/local/Cellar/cmake/3.14.0/share/cmake/Modules/CMakeTestCXXCompiler.cmake:53 (message):
  The C++ compiler

    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/xcodebuild -project CMAKE_TRY_COMPILE.xcodeproj build -target cmTC_2ddc4 -configuration Debug -hideShellScriptEnvironment
    User defaults from command line:
        HideShellScriptEnvironment = YES

    Prepare build
    note: Using legacy build system

    === BUILD TARGET cmTC_2ddc4 OF PROJECT CMAKE_TRY_COMPILE WITH CONFIGURATION Debug ===

    Check dependencies

    Write auxiliary files
    /bin/mkdir -p /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/Objects-normal/arm64
    write-file /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/Objects-normal/arm64/cmTC_2ddc4.LinkFileList

    CompileC CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/Objects-normal/arm64/testCXXCompiler.o testCXXCompiler.cxx normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler
        cd /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\"Debug-appletvos\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.2.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -mtvos-version-min=12.2 -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body -I/Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/Debug/include -I/Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/DerivedSources-normal/arm64 -I/Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/DerivedSources/arm64 -I/Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/Debug -mtvos-version-min=8.0 -fembed-bitcode -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc -mtvos-version-min=8.0 -fembed-bitcode -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc -miphoneos-version-min=8.0 -fembed-bitcode -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc -fembed-bitcode -MMD -MT dependencies -MF /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/Objects-normal/arm64/testCXXCompiler.d --serialize-diagnostics /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/Objects-normal/arm64/testCXXCompiler.dia -c /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx -o /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/Objects-normal/arm64/testCXXCompiler.o
    clang: error: invalid argument '-miphoneos-version-min=8.0' not allowed with '-mtvos-version-min=8.0'
    clang: warning: using sysroot for 'AppleTVOS' but targeting 'iPhone' [-Wincompatible-sysroot]

    ** BUILD FAILED **


    The following build commands failed:
    	CompileC CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/Objects-normal/arm64/testCXXCompiler.o testCXXCompiler.cxx normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler
    (1 failure)




  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!
See also "/Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeOutput.log".
See also "/Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeError.log".

CMakeError.log:

Determining if the CXX compiler works failed with the following output:
Change Dir: /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/xcodebuild -project CMAKE_TRY_COMPILE.xcodeproj build -target cmTC_2ddc4 -configuration Debug -hideShellScriptEnvironment
User defaults from command line:
    HideShellScriptEnvironment = YES

Prepare build
note: Using legacy build system

=== BUILD TARGET cmTC_2ddc4 OF PROJECT CMAKE_TRY_COMPILE WITH CONFIGURATION Debug ===

Check dependencies

Write auxiliary files
/bin/mkdir -p /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/Objects-normal/arm64
write-file /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/Objects-normal/arm64/cmTC_2ddc4.LinkFileList

CompileC CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/Objects-normal/arm64/testCXXCompiler.o testCXXCompiler.cxx normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR=\"Debug-appletvos\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.2.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -mtvos-version-min=12.2 -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body -I/Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/Debug/include -I/Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/DerivedSources-normal/arm64 -I/Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/DerivedSources/arm64 -I/Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/Debug -mtvos-version-min=8.0 -fembed-bitcode -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc -mtvos-version-min=8.0 -fembed-bitcode -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc -miphoneos-version-min=8.0 -fembed-bitcode -fvisibility=hidden -fvisibility-inlines-hidden -fobjc-abi-version=2 -fobjc-arc -fembed-bitcode -MMD -MT dependencies -MF /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/Objects-normal/arm64/testCXXCompiler.d --serialize-diagnostics /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/Objects-normal/arm64/testCXXCompiler.dia -c /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx -o /Users/sylvain/Temp/ios-cmake/example/example-lib/build/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/Objects-normal/arm64/testCXXCompiler.o
clang: error: invalid argument '-miphoneos-version-min=8.0' not allowed with '-mtvos-version-min=8.0'
clang: warning: using sysroot for 'AppleTVOS' but targeting 'iPhone' [-Wincompatible-sysroot]

** BUILD FAILED **


The following build commands failed:
	CompileC CMAKE_TRY_COMPILE.build/Debug-appletvos/cmTC_2ddc4.build/Objects-normal/arm64/testCXXCompiler.o testCXXCompiler.cxx normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

failed in building shared library and demo

when build shared example( add flag -DBUILD_SHARED=1), there is sth. wrong
following

cd example/example-lib
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DIOS_PLATFORM=SIMULATOR64 -DBUILD_SHARED=1
make
Scanning dependencies of target example
[ 20%] Building CXX object CMakeFiles/example.dir/HelloWorld.cpp.o
[ 40%] Building CXX object CMakeFiles/example.dir/HelloWorldIOS.mm.o
[ 60%] Linking CXX shared library libexample.dylib
[ 60%] Built target example
Scanning dependencies of target helloworld
[ 80%] Building CXX object CMakeFiles/helloworld.dir/main.cpp.o
[100%] Linking CXX executable helloworld
Undefined symbols for architecture x86_64:
  "HelloWorld::helloWorld()", referenced from:
      _main in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [helloworld] Error 1
make[1]: *** [CMakeFiles/helloworld.dir/all] Error 2
make: *** [all] Error 2

CMake fails to find XCTest (3.0.1 release)

Hello,

I tried the recent 3.0.1 update, and encountered an issue I can't fix.

For some part of my code, I use CMake to create XCTest targets with your toolchain using XCode generator. For this, I add find_package(XCTest REQUIRED) in my CMakeLists, and use the functions xctest_add_bundle and xctest_add_test to generator my XCTest targets.

Everything worked fine, but when I updated the toolchain from 2.2.0 to the 3.0.1 and changed IOS_PLATFORM to PLATFORM in my Cmake build scrits, I obtained the following error :

CMake Error at /usr/local/Cellar/cmake/3.14.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find XCTest (missing: XCTest_LIBRARY XCTest_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.14.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/Cellar/cmake/3.14.1/share/cmake/Modules/FindXCTest.cmake:84 (find_package_handle_standard_args)
  MWMAudioKit/MWMAudioKit_Core/CoreMathVector-Tests/CMakeLists.txt:30 (find_package)

I'm running CMake 3.14.1 and I have XCode 10.2 with iOS SDK 12.2 installed.

I looked at the diff of your release and tried a few things but couldn't find any solution.
Any idea of something I or you did wrong ?

Thanks again for your work :)

Tom

Wrong minimum OS version flags when IOS_PLATFORM is set to OS64

It looks that in latest version when IOS_PLATFORM is set to "OS64" a toolchain scripts sets wrong flags for minimum required OS version: it sets "-mios-simulator-version-min" instead of "-mios-version-min" because corresponding if/elseif block that checks for value of IOS_PLATFORM is missing check for "OS64" value (it must treat it the same as "OS", I think).

Current workaround is to use "-DIOS_PLATFORM=OS" and manually select architectures with "-DIOS_ARCH=" if they need to be customized.

Symbols not hidden

Hi guys,
I'm following the example usage to build the example. Then I run the app with Xcode + Simulator to build the app. Then I open the app execute file with Hopper Disassembler (a tool can decompiler) and I still see the function name in the example-lib (helloworld()) and how it run inside. So is this a bug in this project or did I need to config anything else to make symbols hidden?
Thank you!

find_package(Boost) no longer works since PR #33

I'm experiencing problems with find_package(Boost) in recent versions of ios-cmake. It seems like db6ed83 in PR #33 introduced a regression in this area.

CMake error:

CMake Error at /Applications/CMake.app/Contents/share/cmake-3.14/Modules/FindBoost.cmake:2132 (message):
  Unable to find the requested Boost libraries.

  Unable to find the Boost header files.  Please set BOOST_ROOT to the root
  directory containing Boost or BOOST_INCLUDEDIR to the directory containing
  Boost's headers.

Minimal reproducer: https://github.com/forderud/BoostCMakeIOS

Use CMAKE_IOS_INSTALL_COMBINED CMake Variable for Universal Library Support Out-of-the-Box

Since CMake 3.5.2, it seems CMake has support for Universal fat libraries out-of-the-box. This can be set with CMAKE_IOS_INSTALL_COMBINED.

From the official documentation for the target property IOS_INSTALL_COMBINED:

When this property is set to set to false (which is the default) then it will either be built with the device SDK or the simulator SDK depending on the SDK set. But if this property is set to true then the target will at install time also be built for the corresponding SDK and combined into one library.

This feature requires at least Xcode version 6.

Internally, it seems to create an install task on the target to build for all the supplied Apple Device SDKs then combine all the binaries into 1 fat binary using lipo.

I haven't actually started using this variable yet, and I'm not exactly sure how it would even fit with the current toolchain, but if I can figure it out before someone else investigates it, I'm willing to create a pull request.

Code Signing Error, `snr_bw_test` is not signed but requires entitlements.

Please ignore this issue, snr_bw_test is coming from the source code of the library that I am trying to build

Description

I am trying to build a FAT lib by using the following cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../../ios-cmake/ios.toolchain.cmake -DPLATFORM=OS64COMBINED

But build keeps failing with the following error message.

Error

Check dependencies
Code Signing Warning: "snr_bw_test" isn't code signed but requires entitlements. It is not possible to add entitlements to a binary without signing it.
Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 12.4'

** BUILD FAILED **

Environment

cmake version 3.15.2
Xcode 10.3

Any ideas on how to resolve that?

example-app build error

I entered the following command at the terminal:

cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DPLATFORM=OS
cmake --build . --config Release --target install

Get a libexample.a . and the architecture for libexample:

➜  example-lib $ lipo -info lib/libexample.a 
Architectures in the fat file: lib/libexample.a are: armv7 armv7s arm64 

But i get a error when i run example-app with Xcode (target iPhone8 device not simulator).

ld: warning: ignoring file /Users/Tomy/Downloads/ios-cmake-master 2/example/example-app/example-lib/lib/libexample.dylib, file was built for i386 which is not the architecture being linked (arm64): /Users/Tomy/Downloads/ios-cmake-master 2/example/example-app/example-lib/lib/libexample.dylib
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_HelloWorldIOS", referenced from:
      objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

CMake version: 3.14.5

How can i fix it.

Code Signing Error: No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "123456789A" with a private key was found.

I was using an earlier version of this toolchain which was working well. I recently switched to HEAD and now I'm getting the following error:

Code Signing Error: No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "123456789A" with a private key was found.

After lots of fruitless Googling I tried to open the project in Xcode and build it from there instead of using cmake --build from the command line. I then noticed that the Development Team (under Build Settings) was "123456789A" instead of the correct value: "Jon McClung (Personal Team)". Manually changing that allowed the build to continue. This made me wonder where "123456789A" was coming from, so I did a global search and found the CMake variable CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM. After changing the Development Team back to "123456789A" in Xcode and setting this variable, the error was resolved.

I'm opening this issue so that other developers who run into the same problem can know how to fix it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.