On 07/10/2013 08:52 AM, Stephen Kelly wrote:
> The problem is revealed because I changed GetCompileDefinitions to populate 
> an out-vector instead of returning a string, which the VS generator used to 
> use directly. The use of ExpandListArguments does not handle the 'escaped' 
> semicolon. Should it be taught to?

The problem is that now you're calling ExpandListArguments twice.
The old code did:

-  targetOptions.AddDefines(target.GetCompileDefinitions(configName).c_str());

and the implementation of AddDefines calls ExpandListArguments.
The new code does:

+  target.GetCompileDefinitions(targetDefines, configName);

which runs ExpandListArguments internally too.  Then you re-compose
a ;-list without re-escaping the semicolons and pass it to

+  targetOptions.AddDefines(targetDefinesString.c_str());

which does ExpandListArguments again.

BTW, the get-then-append pattern used in hunks like this:

+  std::vector<std::string> targetDefines;
+  target.GetCompileDefinitions(targetDefines,
+                               this->ConfigurationName.c_str());
+  this->AppendDefines(defines, targetDefines);

should be refactored to use a helper rather than duplicated.
For example, I was able to reduce a lot of code recently:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d221eac8

Thanks,
-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to