Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -398,6 +398,12 @@ set(LLVM_USE_HOST_TOOLS ON) endif() +if (MSVC_IDE AND NOT (MSVC_VERSION LESS 1900)) + option(LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION "Configure project to use Visual Studio native visualizers" TRUE) +else() + set(LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION FALSE CACHE INTERNAL "For Visual Studio 2013, manually copy natvis files to Documents\\Visual Studio 2013\\Visualizers" FORCE) +endif() + # All options referred to from HandleLLVMOptions have to be specified # BEFORE this include, otherwise options will not be correctly set on # first cmake run @@ -728,6 +734,14 @@ add_subdirectory(cmake/modules) +# Do this by hand instead of using add_llvm_utilities(), which +# tries to create a corresponding executable, which we don't want +if(LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION) + set( LLVM_VISUALIZERS utils/llvm.natvis) + add_custom_target( LLVMVisualizers SOURCES ${LLVM_VISUALIZERS}) + set_target_properties(LLVMVisualizers PROPERTIES FOLDER "Utils") +endif() + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) install(DIRECTORY include/llvm include/llvm-c DESTINATION include @@ -764,6 +778,7 @@ endif() endif() + # This must be at the end of the LLVM root CMakeLists file because it must run # after all targets are created. if(LLVM_DISTRIBUTION_COMPONENTS) Index: utils/llvm.natvis =================================================================== --- utils/llvm.natvis +++ utils/llvm.natvis @@ -1,9 +1,11 @@