Skip to content

Commit 4f1ef81

Browse files
committed
Improve NodeJS build from source.
1 parent aa1b2a6 commit 4f1ef81

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cmake/FindNodeJS.cmake

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,14 +542,17 @@ if(NOT NodeJS_LIBRARY)
542542

543543
message(STATUS "Build NodeJS shared library")
544544

545+
# Create build output directory
546+
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${NodeJS_OUTPUT_PATH}/out)
547+
545548
include(ProcessorCount)
546549

547550
ProcessorCount(N)
548551

549-
if(NOT N EQUAL 0)
550-
execute_process(COMMAND sh -c "make -j${N} -C out BUILDTYPE=${CMAKE_BUILD_TYPE} V=1" WORKING_DIRECTORY "${NodeJS_OUTPUT_PATH}")
552+
if(N GREATER 1)
553+
execute_process(COMMAND sh -c "make -j${N} -C ${NodeJS_OUTPUT_PATH}/out BUILDTYPE=${CMAKE_BUILD_TYPE} V=1" WORKING_DIRECTORY "${NodeJS_OUTPUT_PATH}")
551554
else()
552-
execute_process(COMMAND sh -c "make -C out BUILDTYPE=${CMAKE_BUILD_TYPE} V=1" WORKING_DIRECTORY "${NodeJS_OUTPUT_PATH}")
555+
execute_process(COMMAND sh -c "make -C ${NodeJS_OUTPUT_PATH}/out BUILDTYPE=${CMAKE_BUILD_TYPE} V=1" WORKING_DIRECTORY "${NodeJS_OUTPUT_PATH}")
553556
endif()
554557
endif()
555558
endif()

0 commit comments

Comments
 (0)