Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -347,6 +347,8 @@ option(LLVM_ENABLE_ZLIB "Use zlib for compression/decompression if available." ON) +option(LLVM_ENABLE_DIA_SDK "Use MSVC DIA SDK for debugging if available." ON) + if( LLVM_TARGETS_TO_BUILD STREQUAL "all" ) set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} ) endif() Index: cmake/config-ix.cmake =================================================================== --- cmake/config-ix.cmake +++ cmake/config-ix.cmake @@ -416,7 +416,7 @@ endif () endif () -if( MSVC ) +if( MSVC AND LLVM_ENABLE_DIA_SDK ) set(SHLIBEXT ".lib") set(stricmp "_stricmp") set(strdup "_strdup") @@ -432,13 +432,13 @@ # the DIA SDK folder exists. Should this happen you will need to # uninstall VS 2012 and then re-install VS 2013. if (IS_DIRECTORY ${MSVC_DIA_SDK_DIR}) - set(HAVE_DIA_SDK 1) + set(LLVM_ENABLE_DIA_SDK 1) else() - set(HAVE_DIA_SDK 0) + set(LLVM_ENABLE_DIA_SDK 0) endif() else() - set(HAVE_DIA_SDK 0) -endif( MSVC ) + set(LLVM_ENABLE_DIA_SDK 0) +endif() # FIXME: Signal handler return type, currently hardcoded to 'void' set(RETSIGTYPE void) Index: cmake/modules/LLVMConfig.cmake.in =================================================================== --- cmake/modules/LLVMConfig.cmake.in +++ cmake/modules/LLVMConfig.cmake.in @@ -37,6 +37,8 @@ set(LLVM_ENABLE_ZLIB @LLVM_ENABLE_ZLIB@) +set(LLVM_ENABLE_DIA_SDK @LLVM_ENABLE_DIA_SDK@) + set(LLVM_NATIVE_ARCH @LLVM_NATIVE_ARCH@) set(LLVM_ENABLE_PIC @LLVM_ENABLE_PIC@) Index: docs/CMake.rst =================================================================== --- docs/CMake.rst +++ docs/CMake.rst @@ -366,6 +366,10 @@ Enable building with zlib to support compression/uncompression in LLVM tools. Defaults to ON. +**LLVM_ENABLE_DIA_SDK**:BOOL + Enable building with MSVC DIA SDK for PDB debugging support. Available + only with MSVC. Defaults to ON. + **LLVM_USE_SANITIZER**:STRING Define the sanitizer used to build LLVM binaries and tests. Possible values are ``Address``, ``Memory``, ``MemoryWithOrigins``, ``Undefined``, ``Thread``, Index: include/llvm/Config/config.h.cmake =================================================================== --- include/llvm/Config/config.h.cmake +++ include/llvm/Config/config.h.cmake @@ -39,7 +39,7 @@ #cmakedefine01 HAVE_DECL_STRERROR_S /* Define to 1 if you have the DIA SDK installed, and to 0 if you don't. */ -#cmakedefine01 HAVE_DIA_SDK +#define HAVE_DIA_SDK ${LLVM_ENABLE_DIA_SDK} /* Define to 1 if you have the header file, and it defines `DIR'. */ Index: lib/DebugInfo/PDB/CMakeLists.txt =================================================================== --- lib/DebugInfo/PDB/CMakeLists.txt +++ lib/DebugInfo/PDB/CMakeLists.txt @@ -3,7 +3,7 @@ source_group(${group} FILES ${ARGN}) endmacro() -if(HAVE_DIA_SDK) +if(LLVM_ENABLE_DIA_SDK) include_directories(${MSVC_DIA_SDK_DIR}/include) set(LIBPDB_LINK_FOLDERS "${MSVC_DIA_SDK_DIR}\\lib") if (CMAKE_SIZEOF_VOID_P EQUAL 8) Index: test/lit.site.cfg.in =================================================================== --- test/lit.site.cfg.in +++ test/lit.site.cfg.in @@ -35,7 +35,7 @@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" config.have_zlib = "@HAVE_LIBZ@" config.have_libxar = "@HAVE_LIBXAR@" -config.have_dia_sdk = @HAVE_DIA_SDK@ +config.have_dia_sdk = @LLVM_ENABLE_DIA_SDK@ config.enable_ffi = "@LLVM_ENABLE_FFI@" config.test_examples = "@ENABLE_EXAMPLES@"