Skip to content

Commit be7b2fa

Browse files
committed
cmake: Use parallel builds for protobuf.
1 parent 86a6fe0 commit be7b2fa

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cdk/cmake/DepFindProtobuf.cmake

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,20 @@ if(SUNPRO)
221221
)
222222
endif()
223223

224+
#
225+
# Try using parallel builds for protobuf.
226+
#
227+
228+
set(opt_build)
229+
set(opt_tool)
230+
if(NOT CMAKE_VERSION VERSION_LESS 3.12)
231+
set(opt_build --parallel)
232+
elseif(CMAKE_MAKE_PROGRAM MATCHES "make")
233+
set(opt_tool -j)
234+
endif()
224235

225236
add_custom_command(OUTPUT "${build_stamp}"
226-
COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG_EXPR}
237+
COMMAND ${CMAKE_COMMAND} --build . ${opt_build} --config ${CONFIG_EXPR} -- ${opt_tool}
227238
COMMAND ${CMAKE_COMMAND} -E touch "${build_stamp}"
228239
WORKING_DIRECTORY "${PB_BINARY_DIR}"
229240
COMMENT "Building protobuf"

0 commit comments

Comments
 (0)