I want to remove all the files from my binary directory which has ".asm.js" extension below is my source code
file (REMOVE
${CMAKE_BINARY_DIR}/dist/*.asm.js
)
Unfortunately, It's not able to delete the file which has .asm.js extension. is there anyone who can help me with this Thanks in advance
As CMake docs says :
Remove the given files. The REMOVE_RECURSE mode will remove the given files and directories, also non-empty directories. No error is emitted if a given file does not exist.
So you need to do a list of files to send it to file(REMOVE)
To do it you can use :
file(GLOB MY_FILES ${CMAKE_BINARY_DIR}/dist/*.asm.js)
Or if you want to match them in subdirectories :
file(GLOB_RECURSE MY_FILES ${CMAKE_BINARY_DIR}/dist/*.asm.js)
Then you can use your command :
file (REMOVE
${MY_FILES}
)
if you want to delete all the "asm.js" type of files in the subdirectory as well then you can use the below command
file(GLOB_RECURSE MY_FILES ${CMAKE_BINARY_DIR}/dist/**/*.asm.js)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With