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

Aleksandr Platonov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 00:31:17 PDT 2020


ArcsinX created this revision.
Herald added subscribers: llvm-commits, usaxena95, kadircet, arphaman, jkorous, mgorny.
Herald added a project: LLVM.
ArcsinX requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.

`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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85958

Files:
  llvm/cmake/modules/FindGRPC.cmake


Index: llvm/cmake/modules/FindGRPC.cmake
===================================================================
--- llvm/cmake/modules/FindGRPC.cmake
+++ llvm/cmake/modules/FindGRPC.cmake
@@ -23,7 +23,7 @@
 else()
   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
@@ -32,7 +32,7 @@
     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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85958.285567.patch
Type: text/x-patch
Size: 952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200814/a581a682/attachment.bin>


More information about the llvm-commits mailing list