diff options
Diffstat (limited to 'Source/cmGlobalVisualStudio7Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.cxx | 69 |
1 files changed, 37 insertions, 32 deletions
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 3637fed392..602666ee24 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -8,6 +8,7 @@ #include "cmGeneratorTarget.h" #include "cmLocalVisualStudio7Generator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmUuid.h" #include "cmake.h" #include <cmsys/Encoding.hxx> @@ -101,7 +102,7 @@ void cmGlobalVisualStudio7Generator::EnableLanguage( "Semicolon separated list of supported configuration types, " "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, " "anything else will be ignored.", - cmState::STRING); + cmStateEnums::STRING); } // Create list of configurations requested by user's cache, if any. @@ -118,15 +119,18 @@ void cmGlobalVisualStudio7Generator::EnableLanguage( if (cmSystemTools::GetEnv("CMAKE_MSVCIDE_RUN_PATH", extraPath)) { mf->AddCacheDefinition("CMAKE_MSVCIDE_RUN_PATH", extraPath.c_str(), "Saved environment variable CMAKE_MSVCIDE_RUN_PATH", - cmState::STATIC); + cmStateEnums::STATIC); } } -void cmGlobalVisualStudio7Generator::FindMakeProgram(cmMakefile* mf) +bool cmGlobalVisualStudio7Generator::FindMakeProgram(cmMakefile* mf) { - this->cmGlobalVisualStudioGenerator::FindMakeProgram(mf); + if (!this->cmGlobalVisualStudioGenerator::FindMakeProgram(mf)) { + return false; + } mf->AddDefinition("CMAKE_VS_DEVENV_COMMAND", this->GetDevEnvCommand().c_str()); + return true; } std::string const& cmGlobalVisualStudio7Generator::GetDevEnvCommand() @@ -345,7 +349,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { cmGeneratorTarget const* target = *tt; - if (target->GetType() == cmState::INTERFACE_LIBRARY) { + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } const char* expath = target->GetProperty("EXTERNAL_MSPROJECT"); @@ -377,7 +381,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { cmGeneratorTarget const* target = *tt; - if (target->GetType() == cmState::INTERFACE_LIBRARY) { + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } bool written = false; @@ -409,8 +413,8 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( // Create "solution folder" information from FOLDER target property // if (written && this->UseFolderProperty()) { - const char* targetFolder = target->GetProperty("FOLDER"); - if (targetFolder) { + const std::string targetFolder = target->GetEffectiveFolderName(); + if (!targetFolder.empty()) { std::vector<cmsys::String> tokens = cmSystemTools::SplitString(targetFolder, '/', false); @@ -446,7 +450,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends( for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { cmGeneratorTarget const* target = *tt; - if (target->GetType() == cmState::INTERFACE_LIBRARY) { + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } const char* vcprojName = target->GetProperty("GENERATOR_FILE_NAME"); @@ -676,27 +680,34 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( // if it is a utilitiy target then only make it part of the // default build if another target depends on it int type = target->GetType(); - if (type == cmState::GLOBAL_TARGET) { - // check if INSTALL target is part of default build - if (target->GetName() == "INSTALL") { - // inspect CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD properties - for (std::vector<std::string>::const_iterator i = configs.begin(); - i != configs.end(); ++i) { - const char* propertyValue = - target->Target->GetMakefile()->GetDefinition( - "CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD"); - cmGeneratorExpression ge; - CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = - ge.Parse(propertyValue); - if (cmSystemTools::IsOn( - cge->Evaluate(target->GetLocalGenerator(), *i))) { - activeConfigs.insert(*i); + if (type == cmStateEnums::GLOBAL_TARGET) { + std::list<std::string> targetNames; + targetNames.push_back("INSTALL"); + targetNames.push_back("PACKAGE"); + for (std::list<std::string>::const_iterator t = targetNames.begin(); + t != targetNames.end(); ++t) { + // check if target <*t> is part of default build + if (target->GetName() == *t) { + const std::string propertyName = + "CMAKE_VS_INCLUDE_" + *t + "_TO_DEFAULT_BUILD"; + // inspect CMAKE_VS_INCLUDE_<*t>_TO_DEFAULT_BUILD properties + for (std::vector<std::string>::const_iterator i = configs.begin(); + i != configs.end(); ++i) { + const char* propertyValue = + target->Target->GetMakefile()->GetDefinition(propertyName); + cmGeneratorExpression ge; + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = + ge.Parse(propertyValue); + if (cmSystemTools::IsOn( + cge->Evaluate(target->GetLocalGenerator(), *i))) { + activeConfigs.insert(*i); + } } } } return activeConfigs; } - if (type == cmState::UTILITY && + if (type == cmStateEnums::UTILITY && !this->IsDependedOn(projectTargets, target)) { return activeConfigs; } @@ -727,11 +738,5 @@ bool cmGlobalVisualStudio7Generator::IsDependedOn( std::string cmGlobalVisualStudio7Generator::Encoding() { - std::ostringstream encoding; -#ifdef CMAKE_ENCODING_UTF8 - encoding << "UTF-8"; -#else - encoding << "Windows-1252"; -#endif - return encoding.str(); + return "UTF-8"; } |