Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c OSX弃用警告CMake_Objective C_C_Macos_Cmake_Working Set - Fatal编程技术网

Objective c OSX弃用警告CMake

Objective c OSX弃用警告CMake,objective-c,c,macos,cmake,working-set,Objective C,C,Macos,Cmake,Working Set,我正在使用CMake构建一些代码,这些代码应该根据ScriptingBridge进行编译 我看到数以万计的日志行,例如: In file included from /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Security.framework/Headers/cssmapple.h:30, from /Developer/SDKs/MacOSX10.7.sdk/System/Library

我正在使用
CMake
构建一些代码,这些代码应该根据
ScriptingBridge
进行编译

我看到数以万计的日志行,例如:

In file included from /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Security.framework/Headers/cssmapple.h:30,
                 from /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:25,
                 from /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9,
                 from /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:70,
                 from /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:10,
                 from /Users/codebeaker/Projects/watchedit-client-code/src/libwhatsplaying/include/apple/itunes.h:5,
                 from /Users/codebeaker/Projects/watchedit-client-code/src/libwhatsplaying/src/osx/itunes_scripting_bridge.m:1:
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Security.framework/Headers/cssmtype.h:142: warning: ‘CSSM_GUID’ is deprecated
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Security.framework/Headers/cssmtype.h:143: warning: ‘CSSM_VERSION’ is deprecated
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Security.framework/Headers/cssmtype.h:156: warning: ‘CSSM_GUID’ is deprecated
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Security.framework/Headers/cssmtype.h:197: warning: ‘CSSM_DATA’ is deprecated
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Security.framework/Headers/cssmtype.h:217: warning: ‘CSSM_DATA_PTR’ is deprecated
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Security.framework/Headers/cssmtype.h:220: warning: ‘CSSM_DATA’ is deprecated
()

正在使用以下工具编译这些文件:

/usr/bin/c++    -I/Users/codebeaker/Projects/watchedit-client-code/src/libwhatsplaying/include -I/Users/codebeaker/Projects/watchedit-client-code/src/libwhatsplaying/../libwatchedit/include    -x objective-c -o CMakeFiles/whatsplaying.dir/src/osx/itunes_scripting_bridge.m.o -c /Users/codebeaker/Projects/watchedit-client-code/src/libwhatsplaying/src/osx/itunes_scripting_bridge.m

/usr/bin/gcc -I/Users/codebeaker/Projects/watchedit-client-code/src/libwhatsplaying/include -I/Users/codebeaker/Projects/watchedit-client-code/src/libwhatsplaying/../libwatchedit/include    -F/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks  -x objective-c -o CMakeFiles/whatsplaying.dir/src/osx/itunes_scripting_bridge.m.o -c /Users/codebeaker/Projects/watchedit-client-code/src/libwhatsplaying/src/osx/itunes_scripting_bridge.m
在我的Mac上查看了(Clang)
gcc
的手册页后,有一个听起来很有趣:

-Fdir Add the framework directory dir to the head of the list of directories to be searched for header files. These directories are interleaved with those specified by -I options and are scanned in a left-to-right order. A framework directory is a directory with frameworks in it. A framework is a directory with a "Headers" and/or "PrivateHeaders" directory contained directly in it that ends in ".framework". The name of a framework is the name of this directory excluding the ".framework". Headers associated with the framework are found in one of those two directories, with "Headers" being searched first. A subframework is a framework directory that is in a framework's "Frameworks" directory. Includes of subframework headers can only appear in a header of a framework that contains the subframework, or in a sibling subframework header. Two subframeworks are siblings if they occur in the same framework. A subframework should not have the same name as a framework, a warning will be issued if this is violated. Currently a subframework cannot have subframeworks, in the future, the mechanism may be extended to support this. The standard frameworks can be found in "/System/Library/Frameworks" and "/Library/Frameworks". An example include looks like "#include ", where Framework denotes the name of the framework and header.h is found in the "PrivateHeaders" or "Headers" directory. -iframeworkdir Like -F except the directory is a treated as a system directory. The main effect is to not warn about constructs contained within header files found via dir. -Fdir 将框架目录dir添加到要搜索头文件的目录列表的头部。这些目录与那些目录交错 由-I选项指定,并按从左到右的顺序扫描。 框架目录是包含框架的目录。框架是包含“Headers”和/或“PrivateHeaders”目录的目录 直接在以“.framework”结尾的it中。框架名称是此目录的名称,不包括“.framework”。与关联的标题 该框架位于这两个目录之一,首先搜索“Headers”。子框架是位于 框架的“框架”目录。子框架标题的包含只能出现在包含子框架的框架的标题中,或在 同级子框架标头。如果两个子框架出现在同一框架中,则它们是同级。子框架不应与子框架具有相同的名称 框架中,如果违反此规则,将发出警告。当前子框架不能有子框架,将来可能会 扩展到支持这一点。标准框架可在“/System/Library/frameworks”和“/Library/frameworks”中找到。一个例子包括外观 与“#include”类似,其中Framework表示框架和头的名称。h可在“PrivateHeaders”或“Headers”中找到 目录 -iframeworkdir 与-F类似,只是目录被视为系统目录。其主要作用是不警告所找到的头文件中包含的构造 经由目录。 也许我应该找
-iframework
。在终端上使用
-iframework
构建时,手动完成此操作,不会出现任何弃用警告

但是,CMake不支持使用
-framework
的选项。从他们的
find_library()
文档中:

CMake将使用a-frameworkA和a-F将框架链接到目标


我正在寻找一种安静的方式。我还有来自OpenSSL'x EVA接口的(4倍)较小的警告,我可以处理这些警告。。。提前感谢。

答案是使用
-iframework
,这可能是为了在无法解决系统级弃用警告时忽略它们

相反,我能够使用
-Wno不推荐的声明
,这是一个指向
GCC
的标志,它被记录在案并且随处可见。它是可靠的,我将其包括在我的CMake声明中:

IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  find_and_add_framework(Foundation watchedit)
  find_and_add_framework(Cocoa watchedit)
  find_and_add_framework(AppKit watchedit)
  find_and_add_framework(ScriptingBridge watchedit)
  set_source_files_properties(${sources} PROPERTIES COMPILE_FLAGS
    "-xobjective-c -Wno-deprecated-declarations")
  set_source_files_properties(${sources} PROPERTIES LANGUAGE C)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
对于任何想从中受益的人,下面是
find\u和\u add\u框架
的实现。我不确定是从哪里抄袭的,但这不是我自己的作品:

macro(FIND_AND_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(FIND_AND_ADD_FRAMEWORK)