Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -276,6 +276,9 @@ option(WITH_POLLY "Build LLVM with Polly" ON) option(LINK_POLLY_INTO_TOOLS "Static link Polly into tools" OFF) +option(WITH_LLD "Build LLVM with LLD" ON) +option(WITH_LLDB "Build LLVM with LLDB" ON) + # Define an option controlling whether we should build for 32-bit on 64-bit # platforms, where supported. if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 ) @@ -586,6 +589,18 @@ endif() endif(WITH_POLLY) +if(WITH_LLD) + if(NOT EXISTS ${LLVM_MAIN_SRC_DIR}/tools/lld/CMakeLists.txt) + set(WITH_LLD OFF) + endif() +endif(WITH_LLD) + +if(WITH_LLDB) + if(NOT EXISTS ${LLVM_MAIN_SRC_DIR}/tools/lldb/CMakeLists.txt) + set(WITH_LLDB OFF) + endif() +endif(WITH_LLDB) + if( LLVM_INCLUDE_TOOLS ) add_subdirectory(tools) endif() Index: tools/CMakeLists.txt =================================================================== --- tools/CMakeLists.txt +++ tools/CMakeLists.txt @@ -75,9 +75,19 @@ add_llvm_external_project(llgo) if( NOT LLVM_INCLUDE_TOOLS STREQUAL "bootstrap-only" ) - add_llvm_external_project(lld) - add_llvm_external_project(lldb) + if(WITH_LLD) + add_llvm_external_project(lld) + else(WITH_LLD) + list(APPEND LLVM_IMPLICIT_PROJECT_IGNORE "${LLVM_MAIN_SRC_DIR}/tools/lld") + endif(WITH_LLD) + if(WITH_LLDB) + add_llvm_external_project(lldb) + else(WITH_LLDB) + list(APPEND LLVM_IMPLICIT_PROJECT_IGNORE "${LLVM_MAIN_SRC_DIR}/tools/lldb") + endif(WITH_LLDB) + + # Automatically add remaining sub-directories containing a 'CMakeLists.txt' # file as external projects. add_llvm_implicit_external_projects()