summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2007-03-07 16:03:57 (GMT)
committerKen Martin <ken.martin@kitware.com>2007-03-07 16:03:57 (GMT)
commitbfb3598c4b4ec2fc41eb6e26ea0dbeb9c55f9176 (patch)
treecc73222df613e47f7c828bb75b56253db6b7b563 /Source/cmMakefile.cxx
parent4148fedbf099b3af9fd6d2d4ad8c5de91cd0a956 (diff)
downloadCMake-bfb3598c4b4ec2fc41eb6e26ea0dbeb9c55f9176.zip
CMake-bfb3598c4b4ec2fc41eb6e26ea0dbeb9c55f9176.tar.gz
CMake-bfb3598c4b4ec2fc41eb6e26ea0dbeb9c55f9176.tar.bz2
BUG: improve bad argument handling for INCLUDE_DIRECTORIES and ADD_DEFINITIONS bug 4364
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx28
1 files changed, 27 insertions, 1 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e9b6750..cce03b1 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -859,8 +859,28 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, bool all,
void cmMakefile::AddDefineFlag(const char* flag)
{
+ if (!flag)
+ {
+ return;
+ }
+
+ // remove any \n\r
+ std::string ret = flag;
+ std::string::size_type pos = 0;
+ while((pos = ret.find('\n', pos)) != std::string::npos)
+ {
+ ret[pos] = ' ';
+ pos++;
+ }
+ pos = 0;
+ while((pos = ret.find('\r', pos)) != std::string::npos)
+ {
+ ret[pos] = ' ';
+ pos++;
+ }
+
this->DefineFlags += " ";
- this->DefineFlags += flag;
+ this->DefineFlags += ret;
}
@@ -1111,6 +1131,12 @@ void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath,
void cmMakefile::AddIncludeDirectory(const char* inc, bool before)
{
+ // if there is a newline then break it into multiple arguments
+ if (!inc)
+ {
+ return;
+ }
+
// Don't add an include directory that is already present. Yes,
// this linear search results in n^2 behavior, but n won't be
// getting much bigger than 20. We cannot use a set because of