1SET(ESPRIMA_FILE ${CMAKE_CURRENT_SOURCE_DIR}/esprima.js)
2SET(UNUSED_CONTEXT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/unused/context.js)
3SET(UNUSED_INDEX_FILE ${CMAKE_CURRENT_SOURCE_DIR}/unused/index.js)
4SET(IS_DOC_USED_FILE ${CMAKE_CURRENT_SOURCE_DIR}/is_doc_used.js)
5SET(BUILTIN_JS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/builtin.js)
6
7TRY_RUN(EMBED_DATA_EXITCODE EMBED_DATA_COMPILED
8    ${CMAKE_CURRENT_BINARY_DIR}
9    ${CMAKE_CURRENT_SOURCE_DIR}/embed_data.c
10    RUN_OUTPUT_VARIABLE JSFUNCTION_CONTENTS
11    ARGS ${ESPRIMA_FILE} ${UNUSED_CONTEXT_FILE} ${UNUSED_INDEX_FILE}
12         ${IS_DOC_USED_FILE} ${BUILTIN_JS_FILE})
13
14STRING(REPLACE "\r" "\n" JSFUNCTION_CONTENTS "${JSFUNCTION_CONTENTS}")
15FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/jsfunctions_data.cc "${JSFUNCTION_CONTENTS}")
16