forked from bartvdbraak/blender
Enable header auto-complete suggestions in Xcode
Description of `USER_HEADER_SEARCH_PATHS` build setting: " This is a list of paths to folders to be searched by the compiler for included or imported user header files (those headers listed in quotes) when compiling C, Objective-C, C++, or Objective-C++. Paths are delimited by whitespace, so any paths with spaces in them need to be properly quoted. See Always Search User Paths (Deprecated) (ALWAYS_SEARCH_USER_PATHS) for more details on how this setting is used. If the compiler doesn't support the concept of user headers, then the search paths are prepended to the any existing header search paths defined in Header Search Paths (HEADER_SEARCH_PATHS). " http://help.apple.com/xcode/mac/current/#/itcaec37c2a6 Xcode doesn't use `HEADER_SEARCH_PATHS` for auto-complete. Only the header files in the same directory as the current file are suggested. CMake as of now correctly sets `SYSTEM_HEADER_SEARCH_PATHS` and lumps the rest in `HEADER_SEARCH_PATHS`. The standard way is to use `USER_HEADER_SEARCH_PATHS` & `SYSTEM_HEADER_SEARCH_PATHS` and let `HEADER_SEARCH_PATHS` be used as a fallback for compilers which do not distinguish between `<*.h>` and `"*.h"` syntax. So set `USER_HEADER_SEARCH_PATHS` to the include paths specified in the `CMakeLists.txt` files of all targets.
This commit is contained in:
parent
168653ed1d
commit
27d50d6f67
@ -169,6 +169,26 @@ function(blender_include_dirs_sys
|
||||
include_directories(SYSTEM ${_ALL_INCS})
|
||||
endfunction()
|
||||
|
||||
# Set include paths for header files included with "*.h" syntax.
|
||||
# This enables auto-complete suggestions for user header files on Xcode.
|
||||
# Build process is not affected since the include paths are the same
|
||||
# as in HEADER_SEARCH_PATHS.
|
||||
function(blender_user_header_search_paths
|
||||
name
|
||||
includes
|
||||
)
|
||||
|
||||
if(XCODE)
|
||||
set(_ALL_INCS "")
|
||||
foreach(_INC ${includes})
|
||||
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
|
||||
# _ALL_INCS is a space-separated string of file paths in quotes.
|
||||
set(_ALL_INCS "${_ALL_INCS} \"${_ABS_INC}\"")
|
||||
endforeach()
|
||||
set_target_properties(${name} PROPERTIES XCODE_ATTRIBUTE_USER_HEADER_SEARCH_PATHS "${_ALL_INCS}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(blender_source_group
|
||||
name
|
||||
sources
|
||||
@ -317,6 +337,7 @@ function(blender_add_lib__impl
|
||||
# works fine without having the includes
|
||||
# listed is helpful for IDE's (QtCreator/MSVC)
|
||||
blender_source_group("${name}" "${sources}")
|
||||
blender_user_header_search_paths("${name}" "${includes}")
|
||||
|
||||
list_assert_duplicates("${sources}")
|
||||
list_assert_duplicates("${includes}")
|
||||
|
Loading…
Reference in New Issue
Block a user