[prev in list] [next in list] [prev in thread] [next in thread]
List: cmake
Subject: [CMake] Creating List file outputs from each source file
From: Thomas Fuller <thomas () mcfuller ! com>
Date: 2017-03-30 19:01:26
Message-ID: CAFUUR5duAipB+AfsfspK4ib3O6_zyKNRJJeHMY8a0_+g4EfbuA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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
[Attachment #5 (text/html)]
<div dir="ltr">Hi,<div><br></div><div><p style="margin:0px 0px \
1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica \
neue",helvetica,sans-serif">I hope this is a simple question and I'm just \
missing something fundamental.</p><p style="margin:0px 0px \
1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica \
neue",helvetica,sans-serif">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.</p><p style="margin:0px 0px \
1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica \
neue",helvetica,sans-serif">The current build system, when compiling a file \
called<span class="inbox-inbox-Apple-converted-space"> </span><code \
style="margin:0px;padding:1px \
5px;border:0px;font-size:13px;font-family:consolas,menlo,monaco,"lucida \
console","liberation mono","dejavu sans \
mono","bitstream vera sans mono","courier \
new",monospace,sans-serif;background-color:rgb(239,240,241);white-space:pre-wrap">main.c</code><span \
class="inbox-inbox-Apple-converted-space"> </span>passes<span \
class="inbox-inbox-Apple-converted-space"> </span><code \
style="margin:0px;padding:1px \
5px;border:0px;font-size:13px;font-family:consolas,menlo,monaco,"lucida \
console","liberation mono","dejavu sans \
mono","bitstream vera sans mono","courier \
new",monospace,sans-serif;background-color:rgb(239,240,241);white-space:pre-wrap">-Wa,-alh=.\CortexM0\ARM_GCC_493\Debug/main.lst</code><span \
class="inbox-inbox-Apple-converted-space"> </span>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.</p><p style="margin:0px 0px \
1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica \
neue",helvetica,sans-serif">I've looked at the<span \
class="inbox-inbox-Apple-converted-space"> </span><a \
href="https://cmake.org/cmake/help/v3.7/command/get_filename_component.html" \
rel="nofollow noreferrer" \
style="margin:0px;padding:0px;border:0px;color:rgb(0,89,153);text-decoration:none">get_filename_component</a><span \
class="inbox-inbox-Apple-converted-space"> </span>command, but it appears only to \
get the filename of the output:</p><pre class="inbox-inbox-lang-c \
inbox-inbox-prettyprint inbox-inbox-prettyprinted" \
style="margin-top:0px;margin-bottom:1em;padding:5px;border:0px;font-size:13px;width:auto;max-height:600px;overflow:auto;font-family:consolas,menlo,monaco,"lucida \
console","liberation mono","dejavu sans \
mono","bitstream vera sans mono","courier \
new",monospace,sans-serif;background-color:rgb(239,240,241);color:rgb(57,51,24);word-wrap:normal"><code \
style="margin:0px;padding:0px;border:0px;font-family:consolas,menlo,monaco,"lucida \
console","liberation mono","dejavu sans \
mono","bitstream vera sans mono","courier \
new",monospace,sans-serif;white-space:inherit"><span class="inbox-inbox-pln" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">add_executable</span><span \
class="inbox-inbox-pun" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">(</span><span \
class="inbox-inbox-typ" \
style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)">TestExe</span><span \
class="inbox-inbox-pln" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> main</span><span \
class="inbox-inbox-pun" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">.</span><span \
class="inbox-inbox-pln" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">c</span><span \
class="inbox-inbox-pun" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">)</span><span \
class="inbox-inbox-pln" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> \
get_filename_component</span><span class="inbox-inbox-pun" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">(</span><span \
class="inbox-inbox-pln" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">curr_name </span><span \
class="inbox-inbox-typ" \
style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)">TestExe</span><span \
class="inbox-inbox-pln" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> NAME_WM</span><span \
class="inbox-inbox-pun" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">)</span><span \
class="inbox-inbox-pln" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)"> message</span><span \
class="inbox-inbox-pun" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">(</span><span \
class="inbox-inbox-pln" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">$</span><span \
class="inbox-inbox-pun" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">{</span><span \
class="inbox-inbox-pln" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">curr_name</span><span \
class="inbox-inbox-pun" \
style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)">})</span></code></pre><p \
style="margin:0px 0px \
1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica \
neue",helvetica,sans-serif">As expected, this prints<span \
class="inbox-inbox-Apple-converted-space"> </span><code \
style="margin:0px;padding:1px \
5px;border:0px;font-size:13px;font-family:consolas,menlo,monaco,"lucida \
console","liberation mono","dejavu sans \
mono","bitstream vera sans mono","courier \
new",monospace,sans-serif;background-color:rgb(239,240,241);white-space:pre-wrap">TestExe</code><span \
class="inbox-inbox-Apple-converted-space"> </span>instead of the hoped for<span \
class="inbox-inbox-Apple-converted-space"> </span><code \
style="margin:0px;padding:1px \
5px;border:0px;font-size:13px;font-family:consolas,menlo,monaco,"lucida \
console","liberation mono","dejavu sans \
mono","bitstream vera sans mono","courier \
new",monospace,sans-serif;background-color:rgb(239,240,241);white-space:pre-wrap">main</code></p><p \
style="margin:0px 0px \
1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica \
neue",helvetica,sans-serif">Is there a simple variable I'm overlooking that \
I could put in my toolchain file's CMAKE_C_FLAGS like<span \
class="inbox-inbox-Apple-converted-space"> </span><code \
style="margin:0px;padding:1px \
5px;border:0px;font-size:13px;font-family:consolas,menlo,monaco,"lucida \
console","liberation mono","dejavu sans \
mono","bitstream vera sans mono","courier \
new",monospace,sans-serif;background-color:rgb(239,240,241);white-space:pre-wrap">-Wa,-alh=${CURR_SOURCE}.lst</code>? \
Or some other method that I'm not seeing?</p><p style="margin:0px 0px \
1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(36,39,41);font-family:arial,"helvetica \
neue",helvetica,sans-serif">System info:</p><ul style="margin:0px 0px 1em \
30px;padding:0px;border:0px;font-size:15px;color:rgb(36,39,41);font-family:arial,"helvetica \
neue",helvetica,sans-serif"><li style="margin:0px 0px \
0.5em;padding:0px;border:0px;word-wrap:break-word">Windows 10</li><li \
style="margin:0px 0px 0.5em;padding:0px;border:0px;word-wrap:break-word">Msys \
shell</li><li style="margin:0px 0px \
0.5em;padding:0px;border:0px;word-wrap:break-word">CMake 3.7.2</li><li \
style="margin:0px;padding:0px;border:0px;word-wrap:break-word">arm-none-eabi-gcc \
v4.9.3</li></ul><div><font color="#242729" face="arial, helvetica neue, helvetica, \
sans-serif"><span style="font-size:15px"><br></span></font></div></div><div><span \
style="font-size:15px;color:rgb(36,39,41);font-family:arial,"helvetica \
neue",helvetica,sans-serif">-Thomas Fuller</span><br></div></div>
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at: \
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at \
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic