is there a way to push linker output(MAP file) to separate log file in cmake

I am working in an embedded project with cmake version 3.18.5. The make file of type ninja. The command ninja > log.txt is adding all the log information(file name, warning) along with Map file into log.txt . I don’t want the map file info in log.txt I want the linker output(i.e Map file info) to a separate file and it should not pollute the main log file.

AFAIK, you either need to add the redirection as part of your command in some way or use a wrapper to gather linker output. Ninja’s stdout is hooked up to the stdout all of the commands it runs. AFAIK, there’s no way to say “except this one”.