diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -72,6 +72,20 @@ message(FATAL_ERROR "LLDB test compilers not specified. Tests will not run") endif() + # On MacOS, debugserver needs to be codesigned. Check if we have a certificate instead + # of failing in the middle of the build. + if(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND TARGET debugserver) + execute_process( + COMMAND security find-certificate -Z -p -c lldb_codesign /Library/Keychains/System.keychain + RESULT_VARIABLE cert_return + OUTPUT_QUIET + ERROR_QUIET) + + if (cert_return) + message(FATAL_ERROR "Certificate for debugserver not found. Run scripts/macos-setup-codesign.sh") + endif() + endif() + set(LLDB_TEST_DEPS lldb) # darwin-debug is an hard dependency for the testsuite.