<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<blockquote
 cite="mid:dfdfe01e0802181304h755b651dy446c73c571a60426@mail.gmail.com"
 type="cite">
  <pre wrap="">
    SET(VS_MULTITHREADED_DEBUG_IGNORE_LIBRARY_FLAGS
       "/NODEFAULTLIB:nafxcwd.lib
        /NODEFAULTLIB:libcmtd.lib"
    )
  </pre>
</blockquote>
Hello,<br>
<br>
Why this kind of variable to implement the ignore flag ?<br>
In order to handle flags with this template : /flags:"parameters" for
Visual Studio projects generation, I propose the following strategy:<br>
<br>
-in the cmVS7FlagTable flag table, define a new string value PARAMETERS:<br>
<br>
<small><font face="Courier New">{"IgnoreDefaultLibraryNames",&nbsp;
"NODEFAULTLIB",&nbsp; "default libraries to ignore",&nbsp; "PARAMETERS"},</font></small><br>
<br>
-in the method FillFlagMapFromCommandFlags handle this value:<br>
<br>
<small><font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(0 == strcmp(value.c_str(),
"PARAMETERS"))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // flags with parameters<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int firstPos = flags.find("\"", iBestPos) + 1;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int lastPos = flags.find("\"", firstPos);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::string parameters = flags.substr(firstPos,
lastPos-firstPos);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value = parameters;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::string stringToReplace = ":\"" + parameters + "\"";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmSystemTools::ReplaceString(flags,
stringToReplace.c_str(), "");<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flagMap[curCommand] = value;</font></small><br>
<br>
Now it is possible to use any flags with the template
/flags:"parameters" like any other simple flag.<br>
There are already a bunch of specific variables in CMake, generator
specific variables should be avoided and replaced by a conditionnal
block to set the correct flag for the current generator.<br>
<br>
I attached my flag table and method to handle it. There is also another
feature: if there are
several occurences of the same flag in the string, then only the
left-most flag is processed, the other are discarded (it provides
support for flag overwriting without knowing which flag is already,
useful in sub-directories).<br>
<br>
--Sylvain<br>
</body>
</html>