<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks, Glenn. That almost works. However, the values of <FLAGS> is hard to construct in this case. It looks something like this:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>add_library(mylib, STATIC, ${files})<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>set_target_properties(mylib<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> PROPERTIES PREFIX “”<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> COMPILE_FLAGS ${target_compiler_flags})<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>add_library(mylibd, STATIC, ${files})<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>set_target_properties(mylibd,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> PROPERTIES PREFIX “”<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> COMPILE_FLAGS “-DDEBUG ${target_compiler_flags}”)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>…<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>set(CMAKE_C_COMPILE_OBJECT "${target_compiler} -c <FLAGS> -o <OBJECT>")<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I can replace <FLAGS> with ${target_compiler_flags} yielding this:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>set(CMAKE_C_COMPILE_OBJECT “${target_compiler} –c ${target_compiler_flags} –o <OBJECT>”)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>but then the –DDEBUG is missing for the build of mylibd. I guess both mylibd and mylib use CMAKE_C_COMPILE_OBJECT and I need a way to pass the –DDEBUG to the compile of one and not the other.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>-David<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Glenn Coombs [mailto:glenn.coombs@gmail.com] <br><b>Sent:</b> Wednesday, September 07, 2011 4:19 AM<br><b>To:</b> David Cole<br><b>Cc:</b> David Dunkle; cmake@cmake.org<br><b>Subject:</b> Re: [CMake] novice question: modification of FLAGS rule variable?<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>What you can do however is set the variable which uses the <FLAGS> definition, i.e. CMAKE_C_COMPILE_OBJECT in your example. I have a CMakeLists.txt file where I override the default assembler flags:<br><br>set(CMAKE_ASM-ATT_COMPILE_OBJECT "<CMAKE_ASM-ATT_COMPILER> ${ASM_SYS_FLAGS} -o <OBJECT> <SOURCE>")<br><br>to use what is set in my ASM_SYS_FLAGS variable instead of the default <FLAGS> one. I'm not sure but I think you are supposed to set these sort of variables early on in a CMakeList.txt before the project() or enable_language() commands. Also, I think that later changes to the ASM_SYS_FLAGS variable are ignored.<br><br>--<br>Glenn<o:p></o:p></p><div><p class=MsoNormal>On 5 September 2011 19:53, David Cole <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>> wrote:<o:p></o:p></p><div><div><p class=MsoNormal>On Mon, Sep 5, 2011 at 1:31 PM, David Dunkle <<a href="mailto:ddunkle@arxan.com">ddunkle@arxan.com</a>> wrote:<br>> Is it possible to read and to set a property/rule variable like <FLAGS>?<br>> What syntax would I use to do that? I mean <FLAGS> as it, for example,<br>> appears here:<br>><br>><br>><br>> set(CMAKE_C_COMPILE_OBJECT "${target_compiler} -c <FLAGS> -o <OBJECT>")<br>><br>><br>><br>> For example can I do something like this (this is pseudo code)?<br>><br>><br>><br>> #read<br>><br>> set(MY_FLAGS, ${<FLAGS>} );<br>><br>><br>><br>> …<br>><br>><br>><br>> #set<br>><br>> set(<FLAGS>, ${MY_FLAGS});<br>><br>><br>><br>> In the documentation, here:<br>><br>><br>><br>> <a href="http://cmake.org/Wiki/CMake_Useful_Variables#Expansion_Rules" target="_blank">http://cmake.org/Wiki/CMake_Useful_Variables#Expansion_Rules</a><br>><br>><br>><br>> it hints at this being possible but doesn’t explain, at least not so that I<br>> understand.<br>><br>><br>><br>> Thanks,<br>><br>> -David<br>><br>><br>><br>><br>><o:p></o:p></p></div></div><p class=MsoNormal>> _______________________________________________<br>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>><br>> Visit other Kitware open-source projects at<br>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>><br>> Please keep messages on-topic and check the CMake FAQ at:<br>> <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</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>><br><br>The wiki page is simply misleading. You cannot set those from the<br>CMake language. CMake decides on their values in internal code, and<br>then substitutes appropriately when generating make files or<br>solution/project files for the build system.<br><br>You can set things the "CMAKE_CXX_FLAGS" which eventually get<br>translated into the substitution that CMake performs, but you cannot<br>alter "<FLAGS>" in the rules variables.<br><br><br>HTH,<br>David<br>_______________________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</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>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>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><o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p></div></body></html>