简体   繁体   中英

C++, CMake, and Xcode Symbol Navigator

I am creating C++ project that uses CMake to generate a XCode project. It uses the Boost FileSystem with the lines of code

  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

符号导航器

Is there any way to exclude these? It's unclear what power I have since my project is generated in 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. 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.

Is there a way to indicate that xcode should not include these directories in the navigator?

Use the filters at the bottom:

  • Show only classes and protocols: Click the Classes and Protocols button () in the filter bar at the bottom.
  • Show only project symbols: Click the Project Symbols button () in the filter bar at the bottom.

https://help.apple.com/xcode/mac/current/#/dev2241bf769


Instead of setting include_directories , try setting HEADER_SEARCH_PATHS for the target.

You may need to edit the Boost_INCLUDE_DIRS to make it a space separated string of quoted filepaths.

set_target_properties(${target_name} PROPERTIES XCODE_ATTRIBUTE_USER_HEADER_SEARCH_PATHS "${Boost_INCLUDE_DIRS}")

https://help.apple.com/xcode/mac/current/#/itcaec37c2a6

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM