[llvm] 399e459 - [clangd] Fix find_program() result check when searching for gRPC

Aleksandr Platonov via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 01:34:26 PDT 2020


Author: Aleksandr Platonov
Date: 2020-08-14T11:33:41+03:00
New Revision: 399e4593431cf146c52fc286670f88d6217db631

URL: https://github.com/llvm/llvm-project/commit/399e4593431cf146c52fc286670f88d6217db631
DIFF: https://github.com/llvm/llvm-project/commit/399e4593431cf146c52fc286670f88d6217db631.diff

LOG: [clangd] Fix find_program() result check when searching for gRPC

`find_program(<VAR> ...)` sets <VAR> to <VAR>-NOTFOUND if nothing was found.
So we need to compare <VAR> with "<VAR>-NOTFOUND" or just use `if([NOT] <VAR>)`, because `if(<VAR>)` is false if `<VAR>` ends in the suffix -NOTFOUND.

Reviewed By: kbobyrev

Differential Revision: https://reviews.llvm.org/D85958

Added: 
    

Modified: 
    llvm/cmake/modules/FindGRPC.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/FindGRPC.cmake b/llvm/cmake/modules/FindGRPC.cmake
index bf05a10e69f2..20c1c0f2cb58 100644
--- a/llvm/cmake/modules/FindGRPC.cmake
+++ b/llvm/cmake/modules/FindGRPC.cmake
@@ -31,7 +31,7 @@ else()
   endif()
   find_program(GRPC_CPP_PLUGIN grpc_cpp_plugin)
   find_program(PROTOC protoc)
-  if (GRPC_CPP_PLUGIN-NOTFOUND OR PROTOC-NOTFOUND)
+  if (NOT GRPC_CPP_PLUGIN OR NOT PROTOC)
     message(FATAL_ERROR "gRPC C++ Plugin and Protoc must be on $PATH for Clangd remote index build.")
   endif()
   # On macOS the libraries are typically installed via Homebrew and are not on
@@ -40,7 +40,7 @@ else()
     find_program(HOMEBREW brew)
     # If Homebrew is not found, the user might have installed libraries
     # manually. Fall back to the system path.
-    if (NOT HOMEBREW-NOTFOUND)
+    if (HOMEBREW)
       execute_process(COMMAND ${HOMEBREW} --prefix grpc
         OUTPUT_VARIABLE GRPC_HOMEBREW_PATH
         RESULT_VARIABLE GRPC_HOMEBREW_RETURN_CODE


        


More information about the llvm-commits mailing list