# .lst file generation in cmake

**URL:** <https://discourse.cmake.org/t/lst-file-generation-in-cmake/2600>\
**Category:** Code\
**Tags:** os:windows, gen:makefiles\
**Created:** [January 22, 2021, 5:36am UTC](https://discourse.cmake.org/t/lst-file-generation-in-cmake/2600 "2021-01-22T05:36:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![deepan](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/7bcc69/32.png) [@deepan](https://discourse.cmake.org/u/deepan)\
**Post date:** [January 22, 2021, 5:36am UTC](https://discourse.cmake.org/t/lst-file-generation-in-cmake/2600/1 "2021-01-22T05:36:27Z")

</div>

i want to generate .lst files for my source file. I am successfully able to generate the executable.  
But i dont know how to generate .lst files for my source files.

`get_property(allsrcfiles TARGET myExe PROPERTY SOURCES)`  
`foreach(srcfile IN LISTS allsrcfiles)`  
`set_source_files_properties(${srcfile} PROPERTIES COMPILE_FLAGS "-Wa, anhlmsd=${srcfile}.lst")`  
`endforeach()`

I have added the above script in my CMakelists.txt , if I add the above script iam getting the following error

`[100%] Linking C executable myExe`  
`dld: error: Can't open file 'CMakeFiles/myExe.dir/src/sample.c.obj': No such file or directory`  
`CMakeFiles\myExe.dir\build.make:101: recipe for target 'myExe' failed gmake[2]: *** [myExe] Error 1`  
`CMakeFiles\Makefile2:93: recipe for target 'CMakeFiles/myExe.dir/all' failed`  
`gmake[1]: *** [CMakeFiles/myExe.dir/all] Error 2`  
`Makefile:101: recipe for target 'all' failed`  
`gmake: *** [all] Error 2`

sample.c.obj file is getting generated without source\_file\_properties.

compiler : WIND RIVER  
Target : ppc - embedded  
Host : windows

is list file generation commands depends on the compiler ?

---

<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:** [January 22, 2021, 2:21pm UTC](https://discourse.cmake.org/t/lst-file-generation-in-cmake/2600/2 "2021-01-22T14:21:24Z")

</div>

Are you setting the source file properties in the same directory as `myExe`? I believe that source file properties used to be tied to the directory (and might be no longer?).

Cc: @brad.king

---

<div class="post-metadata">

**Author:** ![deepan](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/7bcc69/32.png) [@deepan](https://discourse.cmake.org/u/deepan)\
**Post date:** [January 27, 2021, 4:09am UTC](https://discourse.cmake.org/t/lst-file-generation-in-cmake/2600/3 "2021-01-27T04:09:34Z")

</div>

Yes… i am setting the source file properties in the same directory as myExe.

@I believe that source file properties used to be tied to the directory (and might be no longer?). – i am not getting the point…could you please elaborate more on this… Thank you.
