MacOS-Frameworks können nicht mit CMake verknüpft werden
Ich versuche mit cmake ein Teilprojekt zu erstellennicht Ein Xcode-Projekt oder sogar eine App für das iPhone. Das Ergebnis ist eine plattformübergreifende, konsolenausführbare Datei.
Ich verwende dieses Handbuch, um Mac OS Frameworks zu verknüpfen:http://www.vtk.org/Wiki/CMake:HowToUseExistingOSXFrameworks
und dieses Makro:
macro(ADD_FRAMEWORK fwname appname)
find_library(FRAMEWORK_${fwname}
NAMES ${fwname}
PATHS ${CMAKE_OSX_SYSROOT}/System/Library
PATH_SUFFIXES Frameworks
NO_DEFAULT_PATH)
if( ${FRAMEWORK_${fwname}} STREQUAL FRAMEWORK_${fwname}-NOTFOUND)
MESSAGE(ERROR ": Framework ${fwname} not found")
else()
TARGET_LINK_LIBRARIES(${appname} ${FRAMEWORK_${fwname}})
MESSAGE(STATUS "Framework ${fwname} found at ${FRAMEWORK_${fwname}}")
endif()
endmacro(ADD_FRAMEWORK)
Dies ist der wichtige Teil in CMakeLists.txt
project(myprojectname)
........
add_executable(mytarget src/mytarget.cpp)
add_framework(CoreMedia mytarget)
add_framework(CoreVideo mytarget)
add_framework(AVFoundation mytarget)
add_framework(Foundation mytarget)
........
Und das ist, was ich habe, wenn ich versuche zu bauen:
WARNING: Target "mytarget" requests linking to directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/CoreMedia.framework". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "mytarget" requests linking to directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/CoreVideo.framework". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "mytarget" requests linking to directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/AVFoundation.framework". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "mytarget" requests linking to directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/Foundation.framework". Targets may link only to libraries. CMake is dropping the item.
Es findet tatsächlich alle diese Frameworks, kann jedoch keine Verknüpfung herstellen, was zu vielen Linkerfehlern führt. Ich bin mir ziemlich sicher, dass dies der Grund ist, weil ich ein Testprojekt mit XCode erstellt habe und es die gleichen Fehler aufweist, bis ich alle benötigten Frameworks verknüpft habe.
Wenn ich nur benutze
FIND_LIBRARY(COREMEDIA_LIB CoreMedia)
...
dannCOREMEDIA_LIB
ist eingestellt aufNOTFOUND
- Was ist los? : /
Ich habe viel gegoogelt, aber nichts :( Fühle mich dort ziemlich verloren.