From a1e41fbff553e18d51ab2b06eba5bc6cc87c5354 Mon Sep 17 00:00:00 2001 From: Mikhail Karasikov Date: Thu, 16 Dec 2021 00:56:35 +0100 Subject: [PATCH] limit number of threads when compiling KMC (#365) --- metagraph/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/metagraph/CMakeLists.txt b/metagraph/CMakeLists.txt index d6bb7748aa..70499fd028 100644 --- a/metagraph/CMakeLists.txt +++ b/metagraph/CMakeLists.txt @@ -174,7 +174,12 @@ execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . if(result) message(FATAL_ERROR "CMake step for KMC failed: ${result}") endif() -execute_process(COMMAND ${CMAKE_COMMAND} --build . --config Release -- -j +include(ProcessorCount) +ProcessorCount(N) +if(N EQUAL 0) + set(N 1) +endif() +execute_process(COMMAND ${CMAKE_COMMAND} --build . --config Release -- -j${N} RESULT_VARIABLE result WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/KMC )