summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-04-24 15:18:06 (GMT)
committerBrad King <brad.king@kitware.com>2009-04-24 15:18:06 (GMT)
commit708d1cf1ee9300bc9b9e26a47e1bbe1718612d6f (patch)
treeda8134e5e88176619d7ffc29ec010a9035540d5e
parent70b2f59c3f9c70c085966bacb1e8a41c3ad2947f (diff)
downloadCMake-708d1cf1ee9300bc9b9e26a47e1bbe1718612d6f.zip
CMake-708d1cf1ee9300bc9b9e26a47e1bbe1718612d6f.tar.gz
CMake-708d1cf1ee9300bc9b9e26a47e1bbe1718612d6f.tar.bz2
ENH: Support more preprocessor values in VS6
Previously we rejected all preprocessor definition values containing spaces for the VS6 IDE generator. In fact VS6 does support spaces but not in combination with '"', '$', or ';', and only if we use the sytnax '-DNAME="value with spaces"' instead of '-D"NAME=value with spaces"'. Now we support all definition values that do not have one of these invalid pairs. See issue #8779.
-rw-r--r--Source/cmLocalGenerator.cxx11
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx5
-rw-r--r--Source/cmMakefile.cxx5
-rw-r--r--Tests/Preprocess/CMakeLists.txt5
4 files changed, 18 insertions, 8 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index c38bedd..f66988e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1994,8 +1994,15 @@ void cmLocalGenerator::AppendDefines(std::string& defines,
}
else
{
- // Make the definition appear properly on the command line.
- defines += this->EscapeForShell(di->c_str(), true);
+ // Make the definition appear properly on the command line. Use
+ // -DNAME="value" instead of -D"NAME=value" to help VS6 parser.
+ std::string::size_type eq = di->find("=");
+ defines += di->substr(0, eq);
+ if(eq != di->npos)
+ {
+ defines += "=";
+ defines += this->EscapeForShell(di->c_str() + eq + 1, true);
+ }
}
}
}
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 8ecfa0d..9373e31 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1712,11 +1712,12 @@ cmLocalVisualStudio6Generator
}
// Now do the VS6-specific check.
- if(define.find_first_of(" ") != define.npos)
+ if(define.find_first_of(" ") != define.npos &&
+ define.find_first_of("\"$;") != define.npos)
{
cmOStringStream e;
e << "WARNING: The VS6 IDE does not support preprocessor definition "
- << "values with spaces.\n"
+ << "values with spaces and '\"', '$', or ';'.\n"
<< "CMake is dropping a preprocessor definition: " << define << "\n"
<< "Consider defining the macro in a (configured) header file.\n";
cmSystemTools::Message(e.str().c_str());
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index a0b536b..fc57276 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1216,10 +1216,11 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
return false;
}
- // VS6 IDE does not support definition values with spaces.
+ // VS6 IDE does not support definition values with spaces in
+ // combination with '"', '$', or ';'.
if((strcmp(this->LocalGenerator->GetGlobalGenerator()->GetName(),
"Visual Studio 6") == 0) &&
- (def.find(" ") != def.npos))
+ (def.find(" ") != def.npos && def.find_first_of("\"$;") != def.npos))
{
return false;
}
diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt
index bb33907..3187c36 100644
--- a/Tests/Preprocess/CMakeLists.txt
+++ b/Tests/Preprocess/CMakeLists.txt
@@ -66,8 +66,9 @@ if(NOT BORLAND AND NOT PP_VS70)
endif(NOT BORLAND AND NOT PP_VS70)
if(NOT PP_VS6)
- # VS 6 IDE: spaces
- # The project parser unconditionally separates arguments at spaces.
+ # VS 6 IDE: spaces and '"', '$', or ';'
+ # The project parser cannot handle spaces if there are quotes.
+ # Since we test passing in a quoted string, we cannot have spaces.
set(STRING_EXTRA "${STRING_EXTRA} ")
if(NOT PP_BORLAND AND NOT PP_WATCOM)