[Lldb-commits] [lldb] [lldb][test] Prefer gmake to make and warn for potentially non-GNU make (PR #119573)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 13 06:13:20 PST 2024


================
@@ -52,13 +52,23 @@ set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_TOOLS_BINARY_DIR}/dsymutil${CMAKE_EXECUTA
 if(LLDB_TEST_MAKE)
   set(LLDB_DEFAULT_TEST_MAKE ${LLDB_TEST_MAKE})
 else()
-  find_program(LLDB_DEFAULT_TEST_MAKE make gmake)
+  # Prefer gmake as it will be a version of GNU make. 'make' could be GNU compatible or not.
+  set(MAKE_NAMES "gmake" "make")
+  find_program(LLDB_DEFAULT_TEST_MAKE NAMES ${MAKE_NAMES})
   if(LLDB_DEFAULT_TEST_MAKE)
     message(STATUS "Found make: ${LLDB_DEFAULT_TEST_MAKE}")
+    execute_process(COMMAND ${LLDB_DEFAULT_TEST_MAKE} --version OUTPUT_VARIABLE MAKE_VERSION
+           ERROR_QUIET)
+    if(NOT MAKE_VERSION MATCHES "^GNU Make")
+      message(WARNING "'make' tool ${LLDB_DEFAULT_TEST_MAKE} may not be GNU make compatible. "
+             "Some tests may fail to build. Provide a GNU compatible 'make' tool by setting "
+             "LLDB_TEST_MAKE.")
+    endif()
   else()
-    message(STATUS "Not found: make")
+    string(REPLACE ";" " " MAKE_NAMES_SPACES "${MAKE_NAMES}")
----------------
labath wrote:

[This](https://cmake.org/cmake/help/latest/command/list.html#join) looks like the modern way to do that.

https://github.com/llvm/llvm-project/pull/119573


More information about the lldb-commits mailing list