[llvm] Guard cmake JOB_POOL property against duplicate entries if … (PR #169052)
Jonas Rickert via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 21 07:18:06 PST 2025
https://github.com/jorickert created https://github.com/llvm/llvm-project/pull/169052
… HandleLLVMOptions gets included multiple times.
Otherwise including HandleLLVMOptions multiple times and setting -DLLVM_PARALLEL_LINK_JOBS=SOME_NUMBER leads to the following ninja error : `duplicate pool 'link_job_pool'`
>From 00c388f177f233ed397f6d1373e3a381155f68b9 Mon Sep 17 00:00:00 2001
From: "Rickert, Jonas" <Jonas.Rickert at amd.com>
Date: Fri, 21 Nov 2025 14:45:24 +0000
Subject: [PATCH] Guard cmake JOB_POOL property against duplicate entries if
HandleLLVMOptions gets included multiple times
Signed-off-by: Rickert, Jonas <Jonas.Rickert at amd.com>
---
llvm/cmake/modules/HandleLLVMOptions.cmake | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 2d78626d953c9..a9b394292eab2 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -57,7 +57,10 @@ if(LLVM_PARALLEL_COMPILE_JOBS)
if(NOT CMAKE_GENERATOR MATCHES "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})
+ get_property(_existing_compile_job_pool GLOBAL PROPERTY JOB_POOLS)
+ if(NOT _existing_compile_job_pool MATCHES "compile_job_pool=")
+ set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${LLVM_PARALLEL_COMPILE_JOBS})
+ endif()
set(CMAKE_JOB_POOL_COMPILE compile_job_pool)
endif()
endif()
@@ -81,7 +84,10 @@ if(CMAKE_GENERATOR MATCHES "Ninja")
set(LLVM_PARALLEL_LINK_JOBS "2")
endif()
if(LLVM_PARALLEL_LINK_JOBS)
- set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${LLVM_PARALLEL_LINK_JOBS})
+ get_property(_existing_job_pools GLOBAL PROPERTY JOB_POOLS)
+ if(NOT _existing_job_pools MATCHES "link_job_pool=")
+ set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${LLVM_PARALLEL_LINK_JOBS})
+ endif()
set(CMAKE_JOB_POOL_LINK link_job_pool)
endif()
elseif(LLVM_PARALLEL_LINK_JOBS)
@@ -105,7 +111,10 @@ if(LLVM_PARALLEL_TABLEGEN_JOBS)
if(NOT CMAKE_GENERATOR MATCHES "Ninja")
message(WARNING "Job pooling is only available with Ninja generators.")
else()
- set_property(GLOBAL APPEND PROPERTY JOB_POOLS tablegen_job_pool=${LLVM_PARALLEL_TABLEGEN_JOBS})
+ get_property(_existing_tablegen_job_pool GLOBAL PROPERTY JOB_POOLS)
+ if(NOT _existing_tablegen_job_pool MATCHES "tablegen_job_pool=")
+ set_property(GLOBAL APPEND PROPERTY JOB_POOLS tablegen_job_pool=${LLVM_PARALLEL_TABLEGEN_JOBS})
+ endif()
# Job pool for tablegen is set on the add_custom_command
endif()
endif()
More information about the llvm-commits
mailing list