<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 14 September 2013 09:59, Alexander Neundorf <span dir="ltr"><<a href="mailto:a.neundorf-work@gmx.net" target="_blank">a.neundorf-work@gmx.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div class="h5">On Friday 13 September 2013, lorddoskias wrote:<br>
> Hello list,<br>
><br>
> I have a couple of questions whose answers I couldn't find. So first<br>
> thing's first - I have the following function which I intend to use to<br>
> add a number of library targets:<br>
><br>
> function(build_mps_m3_lib LIBRARY_NAME C_SOURCE ASM_SOURCE CPU_TYPE)<br>
> set_property(SOURCE ${${C_SOURCE}} PROPERTY COMPILE_FLAGS "-g<br>
> --cpu=${CPU_TYPE} -O0")<br>
> set_property(SOURCE ${${ASM_SOURCE}} PROPERTY COMPILE_FLAGS "-g<br>
> --cpu=${CPU_TYPE} --apcs=interwork")<br>
> add_library(${LIBRARY_NAME} ${${SOURCE}} ${${ASM_SOURCE}})<br>
> set(TARGET_DIR "mps-m3")<br>
> set(ASM_COMPILE_FLAGS "-g --cpu=${CPU_TYPE} --apcs=interwork")<br>
> #custom armasm command line<br>
> set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER><br>
> ${ASM_COMPILE_FLAGS} <SOURCE> -o <OBJECT>")<br>
> #set_target_properties(${LIBRARY_NAME} PROPERTIES C_COMPILE_FLAGS<br>
> "-g --cpu=${CPU_TYPE} -O0")<br>
> endfunction(build_mps_m3_lib)<br>
><br>
><br>
> What I want to achieve is to have clear separation between the ASM<br>
> compiler flags and the C compiler flags. Since I'm not using the GNU<br>
> (ergo GCC) toolchain I cannot simply set the properties on the resulting<br>
> library target to set the COMPILE_FLAGS. Essentially what I want to<br>
> achieve is being able to set arbitrary compile options for the C and ASM<br>
> compiler WITHOUT both of those interfering.<br>
<br>
</div></div>In general they don't interfer.<br>
What compiler and assembler are you using ?<br>
Maybe you need a new "assembler dialect". Those are quite simply to do, you<br>
can have a look e.g. at the files containing "MASM" in their name in Modules/.<br></blockquote><div><br></div><div>Unfortunately I do not find the statement "In generla they don't interfere to be correct". Here is what I'm talking about: <br>
<br></div><div>The default definitions of ASM_COMPILE_OBJECT is : ASM_COMPILE_OBJECTP: <CMAKE_ASM_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE> <br><br></div><div>meaning it will include all defines/flags set by add_definition/set_target_properties for COMPILE_DEFINITIONS or COMPILER_FLAGS. Unfortunately if I have something like the following: <br>
add_library(tx-mps-m4 ${KERNEL_SOURCE})<br>set_target_properties(tx-mps-m4 PROPERTIES COMPILE_FLAGS "-g --cpu=cortex-m4 -O0")<br><br></div><div>I get the exact same flags (-g --cpu and -O0) passed to the assmebler (armasm) in my case. And the assembler doesn't understand the -O0 and it exists. How can I avoid this situation?<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im"><br>
> My second questions: The way I pass the lists of sources is kind of ugly<br>
> - e.g. I'm, in-essence, doing double indirection the ${${blah}} thingy.<br>
> What would be the correct way. I tried with ${blah-list} but this skewed<br>
> the arguments order<br>
<br>
</div>To get full support for keywords etc. in your own macros/functions, have a<br>
look at CMakeParseArguments.cmake.<br>
<br>
Alex<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br></div></div>