[CMake] Visual Studio Intellisense Integration

Dustyn Blasig dustyn at blasig.us
Wed Oct 9 16:23:48 EDT 2019


Hi All,

We are trying to clean up our Visual Studio flow with CMake. However, we
are running into an issue with Intellisense not finding header files
properly if we use target_include_directories(). For instance, given the
simple example below, if we add the "global" include_directories() call
Intellisense will work, but if we use target_include_directories()
approach, Intellisense does not work.

# Works if we use this ...
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

add_library(foo ...)

# Does not work using this ...
target_include_directories(foo PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)

The build is fine, just Intellisense doesn't work. We noticed in the Visual
Studio project file generated for the component the include directories
show up as an AdditionalIncludeDirectories in a few sections like <Midl/>
and <CudaCompile> but not under <ClCommand>, for instance. I'm not sure
where they should show up to affect Intellisense.

In short, before we try a bunch of other stuff, I'd like to know in general
what the status of integration with Intellisense should be so we know what
to expect. Note, we are compiling a project with CUDA source, not sure if
that makes a difference, but we are seeing the behavior even for non-CUDA
targets.

Thanks!
Dustyn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20191009/90b7f308/attachment.html>


More information about the CMake mailing list