<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;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle20
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle22
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@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="color:#1F497D">Anytime John! I ran into the same problem as you when I tried to figure out a way to parse the arguments to my functions and/or macros. Because I couldn’t find the right documentation, I just went ahead and opened
up the module file itself (YourCMakeInstallPath/share/cmake-2.8/Modules/CMakeParseArguments.cmake). I have found from a lot of banging my head against the wall that sometimes it is just easier to look at the code itself. Typically, the module developers do
an excellent job of documenting the commands within the comments header of the file, and I have found that to be the easiest way to find exactly what I need to explain how to use it. Just as an example, here is the section in the CMakeParseArguments.cmake
file that explains what I explained to you:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#00B050"># As an example here a my_install() macro, which takes similar arguments as the<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#00B050"># real install() command:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#00B050">#<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#00B050"># function(MY_INSTALL)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#00B050"># set(options OPTIONAL FAST)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#00B050"># set(oneValueArgs DESTINATION RENAME)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#00B050"># set(multiValueArgs TARGETS CONFIGURATIONS)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#00B050"># cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#00B050"># ...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Do you happen to know what docs you were looking at? It may be worth a little bit to post that to this mailing list so that hopefully the person that wrote those docs could be so kind as to update them with the
correct syntax.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Take Care!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Eric<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<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""> Biddiscombe, John A. [mailto:biddisco@cscs.ch]
<br>
<b>Sent:</b> Friday, October 19, 2012 2:35 PM<br>
<b>To:</b> Eric Clark<br>
<b>Cc:</b> CMake Mailing List (cmake@cmake.org)<br>
<b>Subject:</b> RE: help with cmake_parse_arguments<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">Eric<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">Thanks for pointing that out, the help docs I was looking at didn’t mention
</span><span lang="EN-GB"><multi_value_keywords>, <span style="color:#1F497D">with that added it works as expected.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">Cheers<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D">JB</span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-left:.5in"><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""> Eric Clark [<a href="mailto:eclark@ara.com">mailto:eclark@ara.com</a>]
<br>
<b>Sent:</b> 19 October 2012 19:17<br>
<b>To:</b> Biddiscombe, John A.<br>
<b>Cc:</b> CMake Mailing List (<a href="mailto:cmake@cmake.org">cmake@cmake.org</a>)<br>
<b>Subject:</b> RE: help with cmake_parse_arguments<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:.5in"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="color:#1F497D">John,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="color:#1F497D">The cmake_parse_arguments command takes 5 arguments, not 4. My guess is that you just need to get the arguments right and things should then work for you assuming the rest of your code
is correct. If you look in CMakeParseArguments.cmake you should see the documentation for the command, but I can tell you that the command takes the following arguments:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-family:"Courier New";color:#1F497D">cmake_parse_arguments(prefix options singleValueArgs multiValueArgs ${ARGN})<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="color:#1F497D">The prefix is what is added to the beginning of each variable that is set, the options is a list of parameters that do not have any arguments associated with them (i.e. REQUIRED, NO_DEFAULT_PATH,
etc.), the singleValueArgs is a list of all parameters that have only one argument associated with them, the mutliValueArgs is a list of all parameters that have one or more arguments associated with them, and the last parameter should always be ${ARGN}.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="color:#1F497D">Hope this helps…<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="color:#1F497D">Eric<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-left:.5in"><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"">
<a href="mailto:cmake-bounces@cmake.org">cmake-bounces@cmake.org</a> [<a href="mailto:cmake-bounces@cmake.org">mailto:cmake-bounces@cmake.org</a>]
<b>On Behalf Of </b>Biddiscombe, John A.<br>
<b>Sent:</b> Friday, October 19, 2012 11:32 AM<br>
<b>To:</b> <a href="mailto:cmake@cmake.org">cmake@cmake.org</a><br>
<b>Subject:</b> [CMake] help with cmake_parse_arguments<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas">I don’t understand why this stripped down test gives the wrong results. Can anyone point out what I’ve done wrong. I’m using cmake
2.8.9<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas">Thanks<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas">JB<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas">=== TEST cmake ===<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas">include (CMakeParseArguments)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas">MACRO(ADD_TEXT_TEST)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> CMAKE_PARSE_ARGUMENTS(<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> TEST ""<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> "NAME;COMMAND;ARGSLIST;BASELINE"
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> ${ARGN}<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> )
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> message("TEST_DEFAULT_ARGS is ${TEST_DEFAULT_ARGS} from ${ARGN}")<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> message("TEST_NAME is ${TEST_NAME}")<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> message("TEST_COMMAND is ${TEST_COMMAND}")<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> message("TEST_ARGSLIST is ${TEST_ARGSLIST}")<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> message("TEST_BASELINE is ${TEST_BASELINE}")<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas">ENDMACRO(ADD_TEXT_TEST)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas">set (datafile "Test1.xxx")<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> ADD_TEXT_TEST(<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> NAME
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> testiso_${datafile}<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> COMMAND<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> "RunMe"<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> ARGSLIST<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> 3.5555 nodal "${EAVL_SOURCE_DIR}/data/${datafile}"<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> BASELINE<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> "${CMAKE_CURRENT_SOURCE_DIR}/baseline/testiso/${datafile}.out"<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"> )<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas">=== output ===<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in;text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span lang="EN-GB">Gives output as follows – the name is missing and the arglist is truncated …<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas">TEST_DEFAULT_ARGS is from NAME;testiso_Test1.xxx;COMMAND;RunMe;ARGSLIST;3.5555;nodal;D:/Code/EAVL/data/Test1.xxx;BASELINE;D:/Code/EAVL/test/baseline/testiso/Test1.xxx.out<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas">TEST_NAME is
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas">TEST_COMMAND is RunMe<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas">TEST_ARGSLIST is 3.5555<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas">TEST_BASELINE is D:/Code/EAVL/test/baseline/testiso/Test1.xxx.out<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Courier New"">--
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Courier New"">John Biddiscombe, email:biddisco @.at.@ cscs.ch<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Courier New""><a href="http://www.cscs.ch/"><span style="color:windowtext">http://www.cscs.ch/</span></a><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:10.0pt;font-family:"Courier New"">CSCS, Swiss National Supercomputing Centre | Tel: +41 (91) 610.82.07<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Courier New"">Via Trevano 131, 6900 Lugano</span><span style="font-size:10.0pt;font-family:"Courier New"">, Switzerland | Fax: +41 (91) 610.82.82<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span lang="EN-GB"><o:p> </o:p></span></p>
</div>
</div>
</div>
</body>
</html>