From 637418a8355cf2bc0aa0796c4bd99a65f793c1ed Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 7 Oct 2008 16:23:20 -0400 Subject: BUG: fix for 4524, add support for target properties to set vs source code control information --- Source/cmLocalVisualStudio7Generator.cxx | 32 +++++++++++++++++++++++++++++--- Source/cmSetTargetPropertiesCommand.h | 3 +++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index faeb620..ce603b6 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1832,6 +1832,26 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, { keyword = "Win32Proj"; } + const char* vsProjectname = target.GetProperty("VS_SCC_PROJECTNAME"); + if (!vsProjectname) + { + vsProjectname = ""; + } + const char* vsLocalpath = target.GetProperty("VS_SCC_LOCALPATH"); + if (!vsLocalpath) + { + vsLocalpath = ""; + } + const char* vsProvider = target.GetProperty("VS_SCC_PROVIDER"); + std::string providerString; + if (!vsProvider) + { + providerString = ""; + } + else + { + providerString = "\tSccProvider=\"" + std::string(vsProvider) + "\"\n"; + } cmGlobalVisualStudio7Generator* gg = static_cast(this->GlobalGenerator); fout << "\tName=\"" << projLabel << "\"\n"; @@ -1839,9 +1859,15 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, { fout << "\tProjectGUID=\"{" << gg->GetGUID(libName) << "}\"\n"; } - fout << "\tSccProjectName=\"\"\n" - << "\tSccLocalPath=\"\"\n" - << "\tKeyword=\"" << keyword << "\">\n" + // if we have all the required Source code control tags + // then add that to the project + if(vsProvider && vsLocalpath && vsProjectname) + { + fout << "\tSccProjectName=\"" << vsProjectname << "\"\n" + << "\tSccLocalPath=\"" << vsLocalpath << "\"\n" + << "\tSccProvider=\"" << providerString << "\"\n"; + } + fout << "\tKeyword=\"" << keyword << "\">\n" << "\t\n" << "\t\tPlatformName << "\"/>\n" << "\t\n"; diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index e9ff1ce..78429d2 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -145,6 +145,9 @@ public: "the target in an IDE like visual studio. VS_KEYWORD can be set " "to change the visual studio keyword, for example QT integration " "works better if this is set to Qt4VSv1.0.\n" + "VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER can be set " + "to add support for source control bindings in a Visual Studio " + "project file.\n" "When a library is built CMake by default generates code to remove " "any existing library using all possible names. This is needed " "to support libraries that switch between STATIC and SHARED by " -- cgit v0.12