Having cmake to generate list files as per source file

GCC offers an assembler option to generate list files:

-Wa,-adhln=<path/file.lst>

I know my way around in cmake but I am pulling my hair how to get this in. My struggle is because it is per source file that I like to have the option and the output file is based on the source file name.

Note1: I am crosscompiling for renesas RL78 but that should not matter
Note2: If I run this command manually it works; the list file is generated

So to be clear I like the compile steps to be like this:

rl78-elf-gcc.exe -ID:/sources/RL78/dev_brd_F13_gcc_led_blink/…/includes/R5F10BMG -mg14 -mmul=g14 -Wstack-usage=40 -ffunction-sections -fdata-sections -nostdlib -DDEBUG -O0 -g -Wa,-adlhn=CMakeFiles\rl78_led_blink.dir\src\main.lst -MD -MT CMakeFiles/rl78_led_blink.dir/src/main.c.obj -MF CMakeFiles\rl78_led_blink.dir\src\main.c.obj.d -o CMakeFiles/rl78_led_blink.dir/src/main.c.obj -c D:/sources/RL78/dev_brd_F13_gcc_led_blink/src/main.c

AFAIK, there’s no way to add such a flag except one-by-one. You can set the source file property COMPILE_OPTIONS to contain this, but there’s no way to say “where the object file will be written” to get its directory (yet?).

Thanks @ben.boeckel for the hint. As I reference I like to paste my final solution here for anybody who can use it. The list files end up at the location where the source file resides. If one uses git a simple "git clean -dxf’ will remove them (and all other files that are not registered in the git project!)

cmake_minimum_required(VERSION 3.0)

project(test_list_files)

include_directories(hdr)

set (headers
hdr/add.h
hdr/subtract.h
hdr/multiply.h
hdr/divide.h
)

set (sources
src/main.c
src/add.c
src/subtract.c
src/multiply.c
src/divide.c
)

foreach(source_file IN LISTS sources)
Message(STATUS ${source_file})
set_source_files_properties(${source_file} PROPERTIES COMPILE_OPTIONS “-Wa,-adhln=${CMAKE_CURRENT_SOURCE_DIR}/${source_file}.lst”)
endforeach()

add_executable(${PROJECT_NAME} ${sources} ${headers})

I post my final solution here for anyone to use it. I made a simple example with gcc.
List files end up where the source files reside.

cmake_minimum_required(VERSION 3.0)

project(test_list_files)

include_directories(hdr)

set (headers
    hdr/add.h
    hdr/subtract.h
    hdr/multiply.h
    hdr/divide.h
)

set (sources 
    src/main.c
    src/add.c
    src/subtract.c
    src/multiply.c
    src/divide.c
)

foreach(source_file IN LISTS sources)
    set_source_files_properties(${source_file} PROPERTIES COMPILE_OPTIONS "-Wa,-adhln=${CMAKE_CURRENT_SOURCE_DIR}/${source_file}.lst")
endforeach()

add_executable(${PROJECT_NAME} ${sources} ${headers})