[cmake-developers] Unique compile definitions

Brad King brad.king at kitware.com
Fri Aug 10 11:05:34 EDT 2012


On 08/10/2012 10:30 AM, Stephen Kelly wrote:
> I've updated the branch with the API change to use std::set. The XCode 
> generator does not use the cmLocalGenerator::AppendDefines method, but the 
> VisualStudio6Generator does. 

That wasn't quite what I had in mind.  The string of escaped
defines for the command line should be paired with a set of
raw defines.  Before appending definition to the end of the
string test set insertion:

  if(defined.insert(def).second)
    {
    // first time we see this one
    ...rest of logic to append to "defines" string.
    }

That way no behavior changes unless there is a duplicate.
IMO it is also cleaner to store the unescaped original
definitions in the std::set.

-Brad



More information about the cmake-developers mailing list