From 22be36f8d52fae0f509725253f175b0c1ec65dcc Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 30 Jan 2008 16:22:51 -0500 Subject: ENH: make sure global targets are in the right projects --- Source/cmGlobalVisualStudio7Generator.cxx | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 0a084ee..0af84e2 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -308,20 +308,6 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( cmGlobalGenerator::TargetDependSet& originalTargets ) { - // Create a map of project that should only show up once - // in a project - const char* onlyOnceNames[] = - {"INCLUDE_EXTERNAL_MSPROJECT","CMAKE_CHECK_BUILD_SYSTEM_TARGET", - "INSTALL", "RUN_TESTS", "EDIT_CACHE", "REBUILD_CACHE", "PACKAGE", 0}; - std::map onlyOnceMap; - int i =0; - for(const char* name = onlyOnceNames[i]; - name != 0; name = onlyOnceNames[++i]) - { - onlyOnceMap[name] = 0; - } - // add the CMAKE_CHECK_BUILD_SYSTEM_TARGET - onlyOnceMap[CMAKE_CHECK_BUILD_SYSTEM_TARGET] = 0; std::string rootdir = root->GetMakefile()->GetStartOutputDirectory(); rootdir += "/"; for(cmGlobalGenerator::TargetDependSet::iterator tt = @@ -343,26 +329,21 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( const cmCustomCommandLines& cmds = cc.GetCommandLines(); std::string project = cmds[0][0]; std::string location = cmds[0][1]; - std::cout << "About to call WriteExternalProject " << this->GetName() << "\n"; this->WriteExternalProject(fout, project.c_str(), location.c_str(), cc.GetDepends()); } else { - // if the target is an onlyOnceNames do it once - std::map::iterator o = - onlyOnceMap.find(target->GetName()); bool skip = false; - if(o != onlyOnceMap.end()) + // if it is a global target or the check build system target + // then only use the one that is for the root + if(target->GetType() == cmTarget::GLOBAL_TARGET + || !strcmp(target->GetName(), CMAKE_CHECK_BUILD_SYSTEM_TARGET)) { - if(o->second > 0) + if(target->GetMakefile() != root->GetMakefile()) { skip = true; } - else - { - o->second++; - } } // if not skipping the project then write it into the // solution -- cgit v0.12