[llvm] 41f946a - [cmake] Limit missing external lit warning to be shown once

Dave Lee via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 21:03:56 PDT 2020


Author: Dave Lee
Date: 2020-10-13T21:03:49-07:00
New Revision: 41f946a6d2a4c1b36ee0a63f615a1aa6edf37cab

URL: https://github.com/llvm/llvm-project/commit/41f946a6d2a4c1b36ee0a63f615a1aa6edf37cab
DIFF: https://github.com/llvm/llvm-project/commit/41f946a6d2a4c1b36ee0a63f615a1aa6edf37cab.diff

LOG: [cmake] Limit missing external lit warning to be shown once

When using a custom `LLVM_EXTERNAL_LIT`, it's possible the file may not exist at the CMake is generating the build. One example is LLDB standalone builds. When the external lit doesn't exist, a warning message is emitted, but the warning is printed once for every single lit target. This produces many redundant warnings.

This changes the warning to only be emitted once, controlled by a CACHE variable.

Other options are:
  1. remove the warning
  2. have callers pass an option to silence the warning if desired

See https://reviews.llvm.org/D76945 for some context.

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

Added: 
    

Modified: 
    llvm/cmake/modules/AddLLVM.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 145c432ad0e1..c63463c0bd23 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1658,8 +1658,9 @@ function(get_llvm_lit_path base_dir file_name)
         set(${file_name} ${LIT_FILE_NAME} PARENT_SCOPE)
         set(${base_dir} ${LIT_BASE_DIR} PARENT_SCOPE)
         return()
-      else()
+      elseif (NOT DEFINED CACHE{LLVM_EXTERNAL_LIT_MISSING_WARNED_ONCE})
         message(WARNING "LLVM_EXTERNAL_LIT set to ${LLVM_EXTERNAL_LIT}, but the path does not exist.")
+        set(LLVM_EXTERNAL_LIT_MISSING_WARNED_ONCE YES CACHE INTERNAL "")
       endif()
     endif()
   endif()


        


More information about the llvm-commits mailing list