[英]C++, CMake, and Xcode Symbol Navigator
I am creating C++ project that uses CMake to generate a XCode project.我正在创建使用 CMake 生成 XCode 项目的 C++ 项目。 It uses the Boost FileSystem with the lines of code它使用带有代码行的 Boost FileSystem
SET(BOOST_ROOT ~/libs/boost/boost_1_64_0)
set(Boost_USE_STATIC_LIBS ON)
FIND_PACKAGE(Boost 1.64 EXACT REQUIRED COMPONENTS filesystem)
include_directories(${Boost_INCLUDE_DIRS})
but now the Symbol Navigator is polluted with thousands of Boost classes但现在符号导航器被数千个 Boost 类污染了
Is there any way to exclude these?有什么办法可以排除这些吗? It's unclear what power I have since my project is generated in cmake.由于我的项目是在 cmake 中生成的,我不清楚我有什么权力。 I took a guess and say that my includes were originally #include "boost/filesystem.hpp"
and changed that to #include <boost/filesystem.hpp>
but that doesn't appear to make a difference.我猜测并说我的包含最初是#include "boost/filesystem.hpp"
并将其更改为#include <boost/filesystem.hpp>
但这似乎没有什么区别。 Next, I thought there might be a flag on the cmake include directory command so tried include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
but that didn't work.接下来,我认为 cmake include directory 命令上可能有一个标志,所以尝试了include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
但这没有用。
Is there a way to indicate that xcode should not include these directories in the navigator?有没有办法指示 xcode 不应在导航器中包含这些目录?
Use the filters at the bottom:使用底部的过滤器:
https://help.apple.com/xcode/mac/current/#/dev2241bf769 https://help.apple.com/xcode/mac/current/#/dev2241bf769
Instead of setting include_directories
, try setting HEADER_SEARCH_PATHS
for the target.不要设置include_directories
,而是尝试为目标设置HEADER_SEARCH_PATHS
。
You may need to edit the Boost_INCLUDE_DIRS
to make it a space separated string of quoted filepaths.您可能需要编辑Boost_INCLUDE_DIRS
以使其成为带引号的文件路径的空格分隔字符串。
set_target_properties(${target_name} PROPERTIES XCODE_ATTRIBUTE_USER_HEADER_SEARCH_PATHS "${Boost_INCLUDE_DIRS}")
https://help.apple.com/xcode/mac/current/#/itcaec37c2a6 https://help.apple.com/xcode/mac/current/#/itcaec37c2a6
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.