Skip to content

Commit

Permalink
CMake: Use all available processor cores to build dependencies
Browse files Browse the repository at this point in the history
Co-authored-by: Pavel Rojtberg <[email protected]>
  • Loading branch information
markellus and paroj authored Mar 10, 2023
1 parent e919c62 commit 6e1560e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion CMake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,16 @@ endif()
# if we build our own deps, do it static as it generally eases distribution
set(OGREDEPS_SHARED FALSE)

set(BUILD_COMMAND_OPTS --target install --config ${CMAKE_BUILD_TYPE})
# get available processor cores
include(ProcessorCount)
ProcessorCount(NPROC)

# can not get processor cores, fallback to default value
if(NPROC EQUAL 0)
set(NPROC 2)
endif()

set(BUILD_COMMAND_OPTS --target install -j ${NPROC} --config ${CMAKE_BUILD_TYPE})

set(BUILD_COMMAND_COMMON ${CMAKE_COMMAND}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
Expand Down

0 comments on commit 6e1560e

Please sign in to comment.