Compiling for iOS with CMake

前端 未结 4 797
难免孤独
难免孤独 2020-12-24 14:49

I\'ve compiled a C++ static library by using CMake as my building tool and I want to link it to my iOS app.
I created a simple \'Empty\' application in Xcode and linked

4条回答
  •  庸人自扰
    2020-12-24 15:10

    There is a second version of iOS.cmake located at:

    https://ceres-solver.googlesource.com

    Note: You may find that both versions of iOS.cmake will only build x86 versions of your project. CMake now sets CMAKE_OSX_SYSROOT to the (latest) Mac OS X SDK available on your system. You can fix this by modifying your copy of iOS.cmake to always set CMAKE_OSX_SYSROOT. You can do this by commenting out a couple of lines your copy of iOS.cmake:

    # -- Under CMake 3.4.2, CMAKE_OSX_SYSROOT is automatically defined to point to the latest Mac OS X SDK. --
    # -- So, the iOS SDK is never found.  Grab the correct CMAKE_OS_SYSROOT and ignore any prior setting.   --
    
    # If user did not specify the SDK root to use, then query xcodebuild for it.
    # if (NOT CMAKE_OSX_SYSROOT)
      execute_process(COMMAND xcodebuild -version -sdk ${XCODE_IOS_PLATFORM} Path
        OUTPUT_VARIABLE CMAKE_OSX_SYSROOT
        ERROR_QUIET
        OUTPUT_STRIP_TRAILING_WHITESPACE)
      message (STATUS "Using SDK: ${CMAKE_OSX_SYSROOT} for platform: ${IOS_PLATFORM}")
      message (STATUS "be sure the previous line points to the correct SDK")
    # endif ( )
    

提交回复
热议问题