diff --git a/CMakeLists.txt b/CMakeLists.txt index 635c18a7994..5f4f518d471 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,8 @@ endif() if(CMAKE_GENERATOR STREQUAL "Ninja") set(MAKE_COMMAND make) + set(NINJA_MAKE_JOBS 4 CACHE STRING "specify concurrent level while ninja calling make") + set(NINJA_MAKE_JOBS_FLAG -j${NINJA_MAKE_JOBS}) else() set(MAKE_COMMAND $(MAKE)) endif() diff --git a/cmake/jemalloc.cmake b/cmake/jemalloc.cmake index f7439bb31f6..5c69cfa7010 100644 --- a/cmake/jemalloc.cmake +++ b/cmake/jemalloc.cmake @@ -42,7 +42,7 @@ if(NOT jemalloc_POPULATED) WORKING_DIRECTORY ${jemalloc_BINARY_DIR} ) add_custom_target(make_jemalloc - COMMAND ${MAKE_COMMAND} + COMMAND ${MAKE_COMMAND} ${NINJA_MAKE_JOBS_FLAG} WORKING_DIRECTORY ${jemalloc_BINARY_DIR} BYPRODUCTS ${jemalloc_BINARY_DIR}/lib/libjemalloc.a ) diff --git a/cmake/lua.cmake b/cmake/lua.cmake index 5cbababa65a..0b6827b0cab 100644 --- a/cmake/lua.cmake +++ b/cmake/lua.cmake @@ -34,7 +34,7 @@ if(NOT lua_POPULATED) set(LUA_CFLAGS "${LUA_CFLAGS} -isysroot ${CMAKE_OSX_SYSROOT}") endif() - add_custom_target(make_lua COMMAND ${MAKE_COMMAND} "CC=${LUA_CXX}" "CFLAGS=${LUA_CFLAGS}" liblua.a + add_custom_target(make_lua COMMAND ${MAKE_COMMAND} "CC=${LUA_CXX}" "CFLAGS=${LUA_CFLAGS}" ${NINJA_MAKE_JOBS_FLAG} liblua.a WORKING_DIRECTORY ${lua_SOURCE_DIR}/src BYPRODUCTS ${lua_SOURCE_DIR}/src/liblua.a ) diff --git a/cmake/luajit.cmake b/cmake/luajit.cmake index e17d0c2dea2..2e38efa089b 100644 --- a/cmake/luajit.cmake +++ b/cmake/luajit.cmake @@ -56,7 +56,7 @@ if (NOT lua_POPULATED) set(MACOSX_TARGET "MACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}") endif () - add_custom_target(make_luajit COMMAND ${MAKE_COMMAND} libluajit.a + add_custom_target(make_luajit COMMAND ${MAKE_COMMAND} libluajit.a ${NINJA_MAKE_JOBS_FLAG} "CFLAGS=${LUA_CFLAGS}" ${MACOSX_TARGET} WORKING_DIRECTORY ${luajit_SOURCE_DIR}/src BYPRODUCTS ${luajit_SOURCE_DIR}/src/libluajit.a diff --git a/cmake/lz4.cmake b/cmake/lz4.cmake index ccf37af78db..6df0b48f397 100644 --- a/cmake/lz4.cmake +++ b/cmake/lz4.cmake @@ -32,7 +32,7 @@ if(NOT lz4_POPULATED) set(APPLE_FLAG "CFLAGS=-isysroot ${CMAKE_OSX_SYSROOT}") endif() - add_custom_target(make_lz4 COMMAND ${MAKE_COMMAND} CC=${CMAKE_C_COMPILER} ${APPLE_FLAG} liblz4.a + add_custom_target(make_lz4 COMMAND ${MAKE_COMMAND} CC=${CMAKE_C_COMPILER} ${NINJA_MAKE_JOBS_FLAG} ${APPLE_FLAG} liblz4.a WORKING_DIRECTORY ${lz4_SOURCE_DIR}/lib BYPRODUCTS ${lz4_SOURCE_DIR}/lib/liblz4.a ) diff --git a/cmake/zstd.cmake b/cmake/zstd.cmake index 6a322220c36..2b2fb3c9416 100644 --- a/cmake/zstd.cmake +++ b/cmake/zstd.cmake @@ -32,7 +32,7 @@ if(NOT zstd_POPULATED) set(APPLE_FLAG "CFLAGS=-isysroot ${CMAKE_OSX_SYSROOT}") endif() - add_custom_target(make_zstd COMMAND ${MAKE_COMMAND} CC=${CMAKE_C_COMPILER} ${APPLE_FLAG} libzstd.a + add_custom_target(make_zstd COMMAND ${MAKE_COMMAND} ${NINJA_MAKE_JOBS_FLAG} CC=${CMAKE_C_COMPILER} ${APPLE_FLAG} libzstd.a WORKING_DIRECTORY ${zstd_SOURCE_DIR}/lib BYPRODUCTS ${zstd_SOURCE_DIR}/lib/libzstd.a )