How to trigger recompilation on change of emcc --pre-js source files?

Hello,

I have a working CMakeLists.txt which uses the emscripten compiler frontend (emcc). The core source files are written in C++ and when they are changed, cmake --build triggers recompilation as expected. emcc also accepts auxiliary javascript via the option --pre-js. After much experimentation, I found target_link_options(${PROJECT_NAME} PRIVATE --embed-file assets; -sEXPORT_ES6=1; -sASYNCIFY; --pre-js ${CMAKE_CURRENT_LIST_DIR}/webrtc_check.js) works but when webrtc_check.js changes, cmake does not trigger recompilation. Is there a way to solve this problem? Shane

Does the LINK_DEPENDS target property provide the functionality you’re looking for?

Thanks Craig!

This addition to my CMakeList.txt worked perfectly -

set_target_properties(${PROJECT_NAME} PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_LIST_DIR}/webrtc_check.js)