Skip to content

Commit e5d4e0d

Browse files
authored
Merge pull request #23087 from drodriguez/link-jobs-pool
[cmake] Fix link pool and allow overriding from command line.
2 parents 8d4aa2a + 571790f commit e5d4e0d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

CMakeLists.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,17 @@ endif()
1111
list(APPEND CMAKE_MODULE_PATH
1212
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
1313

14-
# Make a job pool for things that can't yet be distributed
15-
cmake_host_system_information(
16-
RESULT localhost_logical_cores QUERY NUMBER_OF_LOGICAL_CORES)
17-
set_property(GLOBAL PROPERTY JOB_POOLS local_jobs=${localhost_logical_cores})
18-
# Put linking in that category
19-
set_property(GLOBAL PROPERTY JOB_POOL_LINK local_jobs)
14+
if(DEFINED CMAKE_JOB_POOLS)
15+
# CMake < 3.11 doesn't support CMAKE_JOB_POOLS. Manually set the property.
16+
set_property(GLOBAL PROPERTY JOB_POOLS "${CMAKE_JOB_POOLS}")
17+
else()
18+
# Make a job pool for things that can't yet be distributed
19+
cmake_host_system_information(
20+
RESULT localhost_logical_cores QUERY NUMBER_OF_LOGICAL_CORES)
21+
set_property(GLOBAL PROPERTY JOB_POOLS local_jobs=${localhost_logical_cores})
22+
# Put linking in that category
23+
set(CMAKE_JOB_POOL_LINK local_jobs)
24+
endif()
2025

2126
ENABLE_LANGUAGE(C)
2227

0 commit comments

Comments
 (0)