[CMake] Creating List file outputs from each source file

Thomas Fuller thomas at mcfuller.com
Thu Mar 30 15:01:26 EDT 2017


Hi,

I hope this is a simple question and I'm just missing something fundamental.

I'm trying to emulate a binary build manager for an embedded Cortex-M0
target using a CMake project. I'm having some trouble figuring out how to
generate list files for each dependency of my executable target.

The current build system, when compiling a file called main.c passes
-Wa,-alh=.\CortexM0\ARM_GCC_493\Debug/main.lst as an argument to gcc. I'd
like to do something similar, but I can't figure out how to get CMake to
use the current filename being compiled to save the file.

I've looked at the get_filename_component
<https://cmake.org/cmake/help/v3.7/command/get_filename_component.html>
command,
but it appears only to get the filename of the output:

add_executable(TestExe main.c)
get_filename_component(curr_name TestExe NAME_WM)
message(${curr_name})

As expected, this prints TestExe instead of the hoped for main

Is there a simple variable I'm overlooking that I could put in my toolchain
file's CMAKE_C_FLAGS like -Wa,-alh=${CURR_SOURCE}.lst? Or some other method
that I'm not seeing?

System info:

   - Windows 10
   - Msys shell
   - CMake 3.7.2
   - arm-none-eabi-gcc v4.9.3


-Thomas Fuller
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170330/9a274fb0/attachment.html>


More information about the CMake mailing list