From 2c71e13fa68916953a2e77ed031f1a42180dee03 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Sun, 5 May 2024 23:30:36 +0100 Subject: [PATCH] build: Use find_program to find NPM so it can be overridden This is useful for Gentoo, which needs to be able to do entirely offline builds, because it can override this with `true` while shipping pre-compiled assets. Gentoo has tried to ship cached NPM modules instead, but it turns out these are very sensitive to the NPM version. --- cmake/targets/common.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/targets/common.cmake b/cmake/targets/common.cmake index 0cd06288b8d..b7a7a779b04 100644 --- a/cmake/targets/common.cmake +++ b/cmake/targets/common.cmake @@ -16,11 +16,12 @@ else() endif() #WebUI build +find_program(NPM npm REQUIRED) add_custom_target(web-ui ALL WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" COMMENT "Installing NPM Dependencies and Building the Web UI" - COMMAND "$<$:cmd;/C>" npm install - COMMAND "${CMAKE_COMMAND}" -E env "SUNSHINE_BUILD_HOMEBREW=${NPM_BUILD_HOMEBREW}" "SUNSHINE_SOURCE_ASSETS_DIR=${NPM_SOURCE_ASSETS_DIR}" "SUNSHINE_ASSETS_DIR=${NPM_ASSETS_DIR}" "$<$:cmd;/C>" npm run build # cmake-lint: disable=C0301 + COMMAND "$<$:cmd;/C>" "${NPM}" install + COMMAND "${CMAKE_COMMAND}" -E env "SUNSHINE_BUILD_HOMEBREW=${NPM_BUILD_HOMEBREW}" "SUNSHINE_SOURCE_ASSETS_DIR=${NPM_SOURCE_ASSETS_DIR}" "SUNSHINE_ASSETS_DIR=${NPM_ASSETS_DIR}" "$<$:cmd;/C>" "${NPM}" run build # cmake-lint: disable=C0301 COMMAND_EXPAND_LISTS VERBATIM)