siedentop created this revision.
siedentop added reviewers: zturner, beanz, xiaobai, kbobyrev.
Herald added subscribers: llvm-commits, lldb-commits, Sanitizers, lebedev.ri, 
mgorny.
Herald added a reviewer: lebedev.ri.
Herald added projects: Sanitizers, LLDB, LLVM.

Specify message levels in CMake. Prefer STATUS (stdout).

      

As the default message mode (i.e. level) is NOTICE in CMake, more then 
necessary messages get printed to stderr. Some tools,  noticably ccmake treat 
this as an error and require additional confirmation and re-running CMake's 
configuration step.

      

This commit specifies a mode (either STATUS or WARNING or FATAL_ERROR)  instead 
of the default.

- I used `csearch -f 'llvm-project/.+(CMakeLists\.txt|cmake)' -l 'message\("'` 
to find all locations.
- Reviewers were chosen by the most common authors of specific files. If there 
are more suitable reviewers for these CMake changes, please let me know.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63370

Files:
  compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/cmake/modules/LLDBStandalone.cmake
  llvm/cmake/modules/LLVMInstallSymlink.cmake
  llvm/utils/benchmark/CMakeLists.txt
  llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake
  llvm/utils/benchmark/cmake/GetGitVersion.cmake

Index: llvm/utils/benchmark/cmake/GetGitVersion.cmake
===================================================================
--- llvm/utils/benchmark/cmake/GetGitVersion.cmake
+++ llvm/utils/benchmark/cmake/GetGitVersion.cmake
@@ -49,6 +49,6 @@
       set(GIT_VERSION "v0.0.0")
   endif()
 
-  message("-- git Version: ${GIT_VERSION}")
+  message(STATUS "-- git Version: ${GIT_VERSION}")
   set(${var} ${GIT_VERSION} PARENT_SCOPE)
 endfunction()
Index: llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake
===================================================================
--- llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake
+++ llvm/utils/benchmark/cmake/CXXFeatureCheck.cmake
@@ -28,7 +28,7 @@
   endif()
 
   if (NOT DEFINED COMPILE_${FEATURE})
-    message("-- Performing Test ${FEATURE}")
+    message(STATUS "-- Performing Test ${FEATURE}")
     if(CMAKE_CROSSCOMPILING)
       try_compile(COMPILE_${FEATURE}
               ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp
@@ -42,7 +42,7 @@
         set(RUN_${FEATURE} 1)
       endif()
     else()
-      message("-- Performing Test ${FEATURE}")
+      message(STATUS "-- Performing Test ${FEATURE}")
       try_run(RUN_${FEATURE} COMPILE_${FEATURE}
               ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/${FILE}.cpp
               CMAKE_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS}
@@ -51,14 +51,14 @@
   endif()
 
   if(RUN_${FEATURE} EQUAL 0)
-    message("-- Performing Test ${FEATURE} -- success")
+    message(STATUS "-- Performing Test ${FEATURE} -- success")
     set(HAVE_${VAR} 1 PARENT_SCOPE)
     add_definitions(-DHAVE_${VAR})
   else()
     if(NOT COMPILE_${FEATURE})
-      message("-- Performing Test ${FEATURE} -- failed to compile")
+      message(WARNING "-- Performing Test ${FEATURE} -- failed to compile")
     else()
-      message("-- Performing Test ${FEATURE} -- compiled but failed to run")
+      message(STATUS "-- Performing Test ${FEATURE} -- compiled but failed to run")
     endif()
   endif()
 endfunction()
Index: llvm/utils/benchmark/CMakeLists.txt
===================================================================
--- llvm/utils/benchmark/CMakeLists.txt
+++ llvm/utils/benchmark/CMakeLists.txt
@@ -81,7 +81,7 @@
 
 # Tell the user what versions we are using
 string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION ${GIT_VERSION})
-message("-- Version: ${VERSION}")
+message(STATUS "-- Version: ${VERSION}")
 
 # The version of the libraries
 set(GENERIC_LIB_VERSION ${VERSION})
@@ -216,7 +216,7 @@
   elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
           "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
     add_cxx_compiler_flag(-nostdinc++)
-    message("libc++ header path must be manually specified using CMAKE_CXX_FLAGS")
+    message(WARNING "libc++ header path must be manually specified using CMAKE_CXX_FLAGS")
     # Adding -nodefaultlibs directly to CMAKE_<TYPE>_LINKER_FLAGS will break
     # configuration checks such as 'find_package(Threads)'
     list(APPEND BENCHMARK_CXX_LINKER_FLAGS -nodefaultlibs)
Index: llvm/cmake/modules/LLVMInstallSymlink.cmake
===================================================================
--- llvm/cmake/modules/LLVMInstallSymlink.cmake
+++ llvm/cmake/modules/LLVMInstallSymlink.cmake
@@ -12,7 +12,7 @@
 
   set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}/")
 
-  message("Creating ${name}")
+  message(STATUS "Creating ${name}")
 
   execute_process(
     COMMAND "${CMAKE_COMMAND}" -E ${LINK_OR_COPY} "${target}" "${name}"
Index: lldb/cmake/modules/LLDBStandalone.cmake
===================================================================
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -95,7 +95,7 @@
                Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
     endif()
   else()
-    message("-- Found PythonInterp: ${PYTHON_EXECUTABLE}")
+    message(STATUS "-- Found PythonInterp: ${PYTHON_EXECUTABLE}")
   endif()
 
   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
Index: lldb/cmake/modules/LLDBConfig.cmake
===================================================================
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -128,7 +128,7 @@
 # addresses them, but it can be improved and extended on an as-needed basis.
 function(find_python_libs_windows)
   if ("${PYTHON_HOME}" STREQUAL "")
-    message("LLDB embedded Python on Windows requires specifying a value for PYTHON_HOME.  Python support disabled.")
+    message(STATUS "LLDB embedded Python on Windows requires specifying a value for PYTHON_HOME.  Python support disabled.")
     set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
     return()
   endif()
@@ -140,12 +140,12 @@
          REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"")
     string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"+]+)[+]?\".*" "\\1"
          PYTHONLIBS_VERSION_STRING "${python_version_str}")
-    message("-- Found Python version ${PYTHONLIBS_VERSION_STRING}")
+    message(STATUS "-- Found Python version ${PYTHONLIBS_VERSION_STRING}")
     string(REGEX REPLACE "([0-9]+)[.]([0-9]+)[.][0-9]+" "python\\1\\2" PYTHONLIBS_BASE_NAME "${PYTHONLIBS_VERSION_STRING}")
     unset(python_version_str)
   else()
-    message("Unable to find ${PYTHON_INCLUDE_DIR}/patchlevel.h, Python installation is corrupt.")
-    message("Python support will be disabled for this build.")
+    message(WARNING "Unable to find ${PYTHON_INCLUDE_DIR}/patchlevel.h, Python installation is corrupt.")
+    message(WARNING "Python support will be disabled for this build.")
     set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
     return()
   endif()
@@ -165,13 +165,13 @@
 
   foreach(component PYTHON_EXE;PYTHON_LIB;PYTHON_DLL)
     if(NOT EXISTS ${${component}})
-      message("unable to find ${component}")
+      message(WARNING "unable to find ${component}")
       unset(${component})
     endif()
   endforeach()
 
   if (NOT PYTHON_EXE OR NOT PYTHON_LIB OR NOT PYTHON_DLL)
-    message("Unable to find all Python components.  Python support will be disabled for this build.")
+    message(WARNING "Unable to find all Python components.  Python support will be disabled for this build.")
     set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE)
     return()
   endif()
@@ -181,10 +181,10 @@
   set (PYTHON_DLL ${PYTHON_DLL} PARENT_SCOPE)
   set (PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIR} PARENT_SCOPE)
 
-  message("-- LLDB Found PythonExecutable: ${PYTHON_EXE}")
-  message("-- LLDB Found PythonLibs: ${PYTHON_LIB}")
-  message("-- LLDB Found PythonDLL: ${PYTHON_DLL}")
-  message("-- LLDB Found PythonIncludeDirs: ${PYTHON_INCLUDE_DIR}")
+  message(STATUS "-- LLDB Found PythonExecutable: ${PYTHON_EXE}")
+  message(STATUS "-- LLDB Found PythonLibs: ${PYTHON_LIB}")
+  message(STATUS "-- LLDB Found PythonDLL: ${PYTHON_DLL}")
+  message(STATUS "-- LLDB Found PythonIncludeDirs: ${PYTHON_INCLUDE_DIR}")
 endfunction(find_python_libs_windows)
 
 if (NOT LLDB_DISABLE_PYTHON)
Index: compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
===================================================================
--- compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -410,8 +410,8 @@
         INCLUDE ${arch}_FUNCTIONS
         ${${arch}_SOURCES})
       if(NOT ${arch}_filtered_sources)
-        message("${arch}_SOURCES: ${${arch}_SOURCES}")
-        message("${arch}_FUNCTIONS: ${${arch}_FUNCTIONS}")
+        message(WARNING "${arch}_SOURCES: ${${arch}_SOURCES}")
+        message(WARNING "${arch}_FUNCTIONS: ${${arch}_FUNCTIONS}")
         message(FATAL_ERROR "Empty filtered sources!")
       endif()
     endforeach()
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to