From 6d17e684ecbc2fda7ca22eb92798d1df80a2012c Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 21 Jul 2021 10:44:21 +0800 Subject: [PATCH] cmake: use ${NPM} instead of npm so it is more explicit that ${NPM} is used when NODEENV is not specified. Signed-off-by: Kefu Chai --- src/pybind/mgr/dashboard/frontend/CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/dashboard/frontend/CMakeLists.txt b/src/pybind/mgr/dashboard/frontend/CMakeLists.txt index 3d9995b7c5d4b..9928c0e719831 100644 --- a/src/pybind/mgr/dashboard/frontend/CMakeLists.txt +++ b/src/pybind/mgr/dashboard/frontend/CMakeLists.txt @@ -6,7 +6,15 @@ function(add_npm_command) cmake_parse_arguments(NC "${options}" "${single_kw}" "${multi_kw}" ${ARGN}) string(REPLACE ";" " " command "${NC_COMMAND}") if(NC_NODEENV) - string(REGEX REPLACE "^(.*npm .*)$" ". ${mgr-dashboard-nodeenv-dir}/bin/activate && \\1 && deactivate" command ${command}) + string(REGEX REPLACE + "^(([^ ]+=[^ ]+ )*npm .*)$" + ". ${mgr-dashboard-nodeenv-dir}/bin/activate && \\1 && deactivate" + command ${command}) + else() + string(REGEX REPLACE + "^([^ ]=[^ ] )*npm (.*)$" + "\\1${NPM} \\2" + command ${command}) endif() string(REPLACE " " ";" command "${command}") add_custom_command( -- 2.39.5