summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio7Generator.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2010-10-01 21:23:53 (GMT)
committerDavid Cole <david.cole@kitware.com>2010-10-02 18:31:02 (GMT)
commitfd3249e11afeb38284ee8e2012134de4d410c92b (patch)
tree360c3c1fb3993ca3e25a3de663093889a2187ba3 /Source/cmGlobalVisualStudio7Generator.cxx
parente6ac0aacf6c3ce17141870e252fda77d994782d3 (diff)
downloadCMake-fd3249e11afeb38284ee8e2012134de4d410c92b.zip
CMake-fd3249e11afeb38284ee8e2012134de4d410c92b.tar.gz
CMake-fd3249e11afeb38284ee8e2012134de4d410c92b.tar.bz2
New USE_FOLDERS property OFF by default. (#3796)
Visual Studio Express editions do not support solution folders, so default behavior should be as if USE_FOLDERS global property is OFF. Also, allow folder names to be the same as target names: internally, use a prefix to distinguish folder GUIDs from target GUIDs. Add a target and folder with the same name in the ExternalProject test to exercise this code. For CMake itself, provide a new option CMAKE_USE_FOLDERS that defaults to ON so that Visual Studio users get a nicely organized CMake project. Express edition users will have to turn off the CMAKE_USE_FOLDERS option in order to build CMake in the VS Express IDE.
Diffstat (limited to 'Source/cmGlobalVisualStudio7Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index f455810..e08b1ef 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -323,7 +323,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
if (cumulativePath.empty())
{
- cumulativePath = *iter;
+ cumulativePath = "CMAKE_FOLDER_GUID_" + *iter;
}
else
{
@@ -431,14 +431,22 @@ void cmGlobalVisualStudio7Generator
//----------------------------------------------------------------------------
void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout)
{
+ const char *prefix = "CMAKE_FOLDER_GUID_";
+ const std::string::size_type skip_prefix = strlen(prefix);
std::string guidProjectTypeFolder = "2150E333-8FDC-42A3-9474-1A3956D46DE8";
for(std::map<std::string,std::set<std::string> >::iterator iter =
VisualStudioFolders.begin(); iter != VisualStudioFolders.end(); ++iter)
{
std::string fullName = iter->first;
std::string guid = this->GetGUID(fullName.c_str());
- std::string nameOnly = cmSystemTools::GetFilenameName(fullName);
+
cmSystemTools::ReplaceString(fullName, "/", "\\");
+ if (cmSystemTools::StringStartsWith(fullName.c_str(), prefix))
+ {
+ fullName = fullName.substr(skip_prefix);
+ }
+
+ std::string nameOnly = cmSystemTools::GetFilenameName(fullName);
fout << "Project(\"{" <<
guidProjectTypeFolder << "}\") = \"" <<