Skip to content

Commit f954fbb

Browse files
committed
Check if cmake is on the PATH in emcmake.py
Currently, users who run emcmake without cmake on the PATH are greeted with confusing errors like: emcmake cmake .. configure: cmake .. -DCMAKE_TOOLCHAIN_FILE=D:\src\emsdk\upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=D:/src/emsdk/node/18.20.3_64bit/bin/node.exe -G Ninja emcmake: error: 'cmake .. -DCMAKE_TOOLCHAIN_FILE=D:\src\emsdk\upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=D:/src/emsdk/node/18.20.3_64bit/bin/node.exe -G Ninja' failed: [WinError 2] The system cannot find the file specified
1 parent ce52783 commit f954fbb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

emcmake.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def has_substr(args, substr):
4444
# See https://github.com/emscripten-core/emscripten/issues/15522
4545
args.append(f'-DCMAKE_CROSSCOMPILING_EMULATOR={node_js}')
4646

47+
if not shutil.which('cmake'):
48+
print('emcmake: cmake not found on PATH')
49+
return 1
50+
4751
# On Windows specify MinGW Makefiles or ninja if we have them and no other
4852
# toolchain was specified, to keep CMake from pulling in a native Visual
4953
# Studio, or Unix Makefiles.

0 commit comments

Comments
 (0)