[PATCH] D77091: [cmake] Use CMAKE_GENERATOR to determine if Ninja is used

Michael Forney via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 30 14:11:39 PDT 2020


mcf created this revision.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.
mcf added a reviewer: thakis.

The name of the make program does not necessarily match "ninja",
especially if an alternative implementation like samurai is used.

Using CMAKE_GENERATOR is a more robust detection method, and is
already used elsewhere in this file.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77091

Files:
  llvm/cmake/modules/HandleLLVMOptions.cmake


Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -26,7 +26,7 @@
 set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING
   "Define the maximum number of concurrent compilation jobs (Ninja only).")
 if(LLVM_PARALLEL_COMPILE_JOBS)
-  if(NOT CMAKE_MAKE_PROGRAM MATCHES "ninja")
+  if(NOT CMAKE_GENERATOR STREQUAL "Ninja")
     message(WARNING "Job pooling is only available with Ninja generators.")
   else()
     set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${LLVM_PARALLEL_COMPILE_JOBS})
@@ -36,7 +36,7 @@
 
 set(LLVM_PARALLEL_LINK_JOBS "" CACHE STRING
   "Define the maximum number of concurrent link jobs (Ninja only).")
-if(CMAKE_MAKE_PROGRAM MATCHES "ninja")
+if(CMAKE_GENERATOR STREQUAL "Ninja")
   if(NOT LLVM_PARALLEL_LINK_JOBS AND uppercase_LLVM_ENABLE_LTO STREQUAL "THIN")
     message(STATUS "ThinLTO provides its own parallel linking - limiting parallel link jobs to 2.")
     set(LLVM_PARALLEL_LINK_JOBS "2")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77091.253694.patch
Type: text/x-patch
Size: 1096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200330/e3a3ce64/attachment-0001.bin>


More information about the llvm-commits mailing list