diff options
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 53f0a3d..33e76b2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1130,57 +1130,38 @@ cmTarget* cmMakefile::AddUtilityCommand( return target; } -void cmMakefile::AddDefineFlag(std::string const& flag) -{ - if (flag.empty()) { - return; - } - - // Update the string used for the old DEFINITIONS property. - this->AddDefineFlag(flag, this->DefineFlagsOrig); - - // If this is really a definition, update COMPILE_DEFINITIONS. - if (this->ParseDefineFlag(flag, false)) { - return; - } - - // Add this flag that does not look like a definition. - this->AddDefineFlag(flag, this->DefineFlags); -} - -void cmMakefile::AddDefineFlag(std::string const& flag, std::string& dflags) +static void s_AddDefineFlag(std::string const& flag, std::string& dflags) { // remove any \n\r std::string::size_type initSize = dflags.size(); - dflags += std::string(" ") + flag; + dflags += ' '; + dflags += flag; std::string::iterator flagStart = dflags.begin() + initSize + 1; std::replace(flagStart, dflags.end(), '\n', ' '); std::replace(flagStart, dflags.end(), '\r', ' '); } -void cmMakefile::RemoveDefineFlag(std::string const& flag) +void cmMakefile::AddDefineFlag(std::string const& flag) { - // Check the length of the flag to remove. if (flag.empty()) { return; } - std::string::size_type const len = flag.length(); + // Update the string used for the old DEFINITIONS property. - this->RemoveDefineFlag(flag, len, this->DefineFlagsOrig); + s_AddDefineFlag(flag, this->DefineFlagsOrig); // If this is really a definition, update COMPILE_DEFINITIONS. - if (this->ParseDefineFlag(flag, true)) { + if (this->ParseDefineFlag(flag, false)) { return; } - // Remove this flag that does not look like a definition. - this->RemoveDefineFlag(flag, len, this->DefineFlags); + // Add this flag that does not look like a definition. + s_AddDefineFlag(flag, this->DefineFlags); } -void cmMakefile::RemoveDefineFlag(std::string const& flag, - std::string::size_type len, - std::string& dflags) +static void s_RemoveDefineFlag(std::string const& flag, std::string& dflags) { + std::string::size_type const len = flag.length(); // Remove all instances of the flag that are surrounded by // whitespace or the beginning/end of the string. for (std::string::size_type lpos = dflags.find(flag, 0); @@ -1195,6 +1176,25 @@ void cmMakefile::RemoveDefineFlag(std::string const& flag, } } +void cmMakefile::RemoveDefineFlag(std::string const& flag) +{ + // Check the length of the flag to remove. + if (flag.empty()) { + return; + } + + // Update the string used for the old DEFINITIONS property. + s_RemoveDefineFlag(flag, this->DefineFlagsOrig); + + // If this is really a definition, update COMPILE_DEFINITIONS. + if (this->ParseDefineFlag(flag, true)) { + return; + } + + // Remove this flag that does not look like a definition. + s_RemoveDefineFlag(flag, this->DefineFlags); +} + void cmMakefile::AddCompileDefinition(std::string const& option) { this->AppendProperty("COMPILE_DEFINITIONS", option.c_str()); |