summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 4542672..e87f81b 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -909,8 +909,11 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
compileCommand, vars);
std::string workingDirectory =
this->LocalGenerator->GetCurrentBinaryDirectory();
- compileCommand.replace(compileCommand.find(langFlags), langFlags.size(),
- this->GetFlags(lang, this->GetConfigName()));
+ std::string::size_type lfPos = compileCommand.find(langFlags);
+ if (lfPos != std::string::npos) {
+ compileCommand.replace(lfPos, langFlags.size(),
+ this->GetFlags(lang, this->GetConfigName()));
+ }
std::string langDefines = std::string("$(") + lang + "_DEFINES)";
std::string::size_type ldPos = compileCommand.find(langDefines);
if (ldPos != std::string::npos) {