Skip to content

Commit c1cbe08

Browse files
authored
Fix node_helper.cmake for wasm build on Windows (microsoft#25517)
### Description When building targeting wasm, `WIN32` is `false`. Use `CMAKE_HOST_WIN32` instead. ### Motivation and Context Fix the problem when building wasm on Windows, node_helper cannot find NPM correctly.
1 parent 223c4a0 commit c1cbe08

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmake/node_helper.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.25)
66
# Function to get NPM path from Node.js path
77
function(get_npm_path_from_node result_var node_path)
88
get_filename_component(NODE_DIR ${node_path} DIRECTORY)
9-
if(WIN32)
9+
if(CMAKE_HOST_WIN32)
1010
set(NPM_CLI_CANDIDATE "${NODE_DIR}/npm.cmd")
1111
if(NOT EXISTS ${NPM_CLI_CANDIDATE})
1212
set(NPM_CLI_CANDIDATE "${NODE_DIR}/npm")

0 commit comments

Comments
 (0)