# Can you obtain the entire compiler/Linker command line?

**URL:** <https://discourse.cmake.org/t/can-you-obtain-the-entire-compiler-linker-command-line/7728>\
**Category:** Code\
**Created:** [March 20, 2023, 5:45pm UTC](https://discourse.cmake.org/t/can-you-obtain-the-entire-compiler-linker-command-line/7728 "2023-03-20T17:45:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mfarver](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@mfarver](https://discourse.cmake.org/u/mfarver)\
**Post date:** [March 20, 2023, 5:45pm UTC](https://discourse.cmake.org/t/can-you-obtain-the-entire-compiler-linker-command-line/7728/1 "2023-03-20T17:45:15Z")

</div>

To append a CRC to my microcontroller application I need to run the linker twice. I have it doing all the build steps and calculating the CRC from the artifacts, but I’m struggling with how to run the linker a second time with the CRC included. Before cmake the scripts copied the Makefile, edited it and ran the new file as a post compile step. Is there any way to obtain the exact command line cmake ran to run the linker (through the compiler)? I could edit that command line to add the CRC and execute it. Or is there a better way?

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [March 20, 2023, 9:51pm UTC](https://discourse.cmake.org/t/can-you-obtain-the-entire-compiler-linker-command-line/7728/2 "2023-03-20T21:51:23Z")

</div>

You probably want [`<LANG>_LINKER_LAUNCHER`](https://cmake.org/cmake/help/latest/prop_tgt/LANG_LINKER_LAUNCHER.html) to be a script that does the double linking internally using the arguments given.

---

<div class="post-metadata">

**Author:** ![mfarver](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@mfarver](https://discourse.cmake.org/u/mfarver)\
**Post date:** [March 22, 2023, 12:56pm UTC](https://discourse.cmake.org/t/can-you-obtain-the-entire-compiler-linker-command-line/7728/3 "2023-03-22T12:56:52Z")

</div>

That worked great, thank you. It was easy to write a script that ran the linker with a dummy CRC, ran a CRC calculation and then re-ran the linker to add the correct CRC value.
