diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -373,17 +373,17 @@ # Figure out if lldb could use lldb-server. If so, then we'll # ensure we build lldb-server when an lldb target is being built. if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD") - set(LLDB_CAN_USE_LLDB_SERVER 1) + set(LLDB_CAN_USE_LLDB_SERVER ON) else() - set(LLDB_CAN_USE_LLDB_SERVER 0) + set(LLDB_CAN_USE_LLDB_SERVER OFF) endif() # Figure out if lldb could use debugserver. If so, then we'll # ensure we build debugserver when we build lldb. -if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) - set(LLDB_CAN_USE_DEBUGSERVER 1) +if (CMAKE_SYSTEM_NAME MATCHES "Darwin") + set(LLDB_CAN_USE_DEBUGSERVER ON) else() - set(LLDB_CAN_USE_DEBUGSERVER 0) + set(LLDB_CAN_USE_DEBUGSERVER OFF) endif() if (NOT LLDB_DISABLE_CURSES) diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt --- a/lldb/test/CMakeLists.txt +++ b/lldb/test/CMakeLists.txt @@ -101,11 +101,18 @@ lldb_find_system_debugserver(system_debugserver_path) message(STATUS "LLDB tests use out-of-tree debugserver: ${system_debugserver_path}") list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver) - else() + elseif(TARGET debugserver) set(debugserver_path ${LLVM_RUNTIME_OUTPUT_INTDIR}/debugserver) message(STATUS "LLDB Tests use just-built debugserver: ${debugserver_path}") list(APPEND LLDB_TEST_COMMON_ARGS --server ${debugserver_path}) add_dependencies(lldb-test-deps debugserver) + elseif(TARGET lldb-server) + set(lldb_server_path ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-server) + message(STATUS "LLDB Tests use just-built lldb-server: ${lldb_server_path}") + list(APPEND LLDB_TEST_COMMON_ARGS --server ${lldb_server_path}) + add_dependencies(lldb-test-deps lldb-server) + else() + message(WARNING "LLDB Tests enabled, but no server available") endif() endif() diff --git a/lldb/tools/CMakeLists.txt b/lldb/tools/CMakeLists.txt --- a/lldb/tools/CMakeLists.txt +++ b/lldb/tools/CMakeLists.txt @@ -11,8 +11,8 @@ add_lldb_tool_subdirectory(lldb-vscode) if (CMAKE_SYSTEM_NAME MATCHES "Darwin") - add_subdirectory(darwin-debug) - add_subdirectory(debugserver) + add_lldb_tool_subdirectory(darwin-debug) + add_lldb_tool_subdirectory(debugserver) endif() if (LLDB_CAN_USE_LLDB_SERVER) diff --git a/lldb/unittests/CMakeLists.txt b/lldb/unittests/CMakeLists.txt --- a/lldb/unittests/CMakeLists.txt +++ b/lldb/unittests/CMakeLists.txt @@ -78,6 +78,6 @@ add_subdirectory(UnwindAssembly) add_subdirectory(Utility) -if(LLDB_CAN_USE_DEBUGSERVER AND NOT LLDB_USE_SYSTEM_DEBUGSERVER) +if(LLDB_CAN_USE_DEBUGSERVER AND LLDB_TOOL_DEBUGSERVER_BUILD AND NOT LLDB_USE_SYSTEM_DEBUGSERVER) add_subdirectory(debugserver) endif() diff --git a/lldb/unittests/tools/lldb-server/CMakeLists.txt b/lldb/unittests/tools/lldb-server/CMakeLists.txt --- a/lldb/unittests/tools/lldb-server/CMakeLists.txt +++ b/lldb/unittests/tools/lldb-server/CMakeLists.txt @@ -13,7 +13,7 @@ add_lldb_test_executable(thread_inferior inferior/thread_inferior.cpp) add_lldb_test_executable(environment_check inferior/environment_check.cpp) -if(LLDB_CAN_USE_DEBUGSERVER) +if(LLDB_CAN_USE_DEBUGSERVER AND LLDB_TOOL_DEBUGSERVER_BUILD) if(LLDB_USE_SYSTEM_DEBUGSERVER) lldb_find_system_debugserver(debugserver_path) else()