|
|
@@ -42,9 +42,12 @@ if (NOT EXISTS ${EMSCRIPTEN_ROOT_PATH}/emcc)
|
|
|
message (FATAL_ERROR "Could not find Emscripten cross compilation tool. "
|
|
|
"Use EMSCRIPTEN_ROOT_PATH environment variable or build option to specify the location of the toolchain.")
|
|
|
endif ()
|
|
|
-if (NOT EMCC_VERSION AND NOT CMAKE_HOST_WIN32)
|
|
|
- execute_process (COMMAND ${EMSCRIPTEN_ROOT_PATH}/emcc --version COMMAND grep -oP \\d+\\.\\d+\\.\\d+ RESULT_VARIABLE EXIT_CODE OUTPUT_VARIABLE EMCC_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
- set (EMCC_VERSION ${EMCC_VERSION} CACHE STRING "emcc version on Unix-alike host system")
|
|
|
+if (NOT EMCC_VERSION)
|
|
|
+ execute_process (COMMAND ${EMSCRIPTEN_ROOT_PATH}/emcc --version RESULT_VARIABLE EXIT_CODE OUTPUT_VARIABLE EMCC_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
+ if (EXIT_CODE EQUAL 0)
|
|
|
+ string (REGEX MATCH "[^ .]+\\.[^.]+\\.[^ ]+" EMCC_VERSION ${EMCC_VERSION})
|
|
|
+ endif ()
|
|
|
+ set (EMCC_VERSION ${EMCC_VERSION} CACHE STRING "emcc version being used in this build tree") # Cache the result even when there was error in determining the version
|
|
|
endif ()
|
|
|
if (CMAKE_HOST_WIN32)
|
|
|
set (TOOL_EXT .bat)
|