How to add facebookSDK to xcode project using cmake?

Am I having difficulty adding facebookSDK.framework to my xcode project using cmake? Here is what I have done so far. But it does not work

set (facebook_sdk_path ${CMAKE_HOME_DIRECTORY}/external/framework/facebook/ios) message("adding facebookSDK" ${facebook_sdk_path}) target_link_libraries(${Target} "${facebook_sdk_path}/facebookSDK.framework/facebookSDK") 

I believe that we need to install the framework under the "wireframe search path" in the project settings, but I'm not quite sure how to do this.

0
ios build xcode cmake
May 23 '13 at 18:10
source share
2 answers

found my solution: I used this macro, which I found from CMake and Xcode: "cannot find interface declaration for 'NSObject'"

 macro(AddExternalFramework fwname appname libpath) find_library(FRAMEWORK_${fwname} NAMES ${fwname} PATHS ${libpath} NO_DEFAULT_PATH) if( ${FRAMEWORK_${fwname}} STREQUAL FRAMEWORK_${fwname}-NOTFOUND) MESSAGE(ERROR ": Framework ${fwname} not found: ${FRAMEWORK_${fwname}}") else() TARGET_LINK_LIBRARIES(${appname} ${FRAMEWORK_${fwname}}) MESSAGE(STATUS "Framework ${fwname} found at ${FRAMEWORK_${fwname}}") endif() endmacro(AddExternalFramework) 
0
May 30 '13 at 18:14
source share

I came across the same question, but Frank's answer didn't work for me. As mentioned in the message calling TARGET_LINK_LIBRARIES , the variable FRAMEWORK_SEARCH_PATHS is placed. In my case, it finds FacebookSDK.framework , but then generates linker errors for the rest of the included frameworks (e.g. UIKit, Foundation, etc.).

My solution was to simply copy FacebookSDK.framework to the Xcode framework folders. Keep in mind that you need to copy it to iPhoneOS and iPhoneSimulator if you create for the device and simulator. Currently, Xcode7 and SDK9.0 are located in the following folders:

  • /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks
  • /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/System/Library/Frameworks

Adding FacebookSDK.framework , as usual, works fine:

 SET (OUR_FRAMEWORKS "-framework Foundation -framework UIKit -framework FacebookSDK ...") 
0
Aug 29 '14 at 8:08
source share



All Articles