STYLE: Replace large if() with named boolean

In cmLocalVisualStudio{6,7}Generator this replaces a large if() test
with a re-usable result stored in a boolean variable named accordingly.
This commit is contained in:
Brad King 2009-07-03 10:33:34 -04:00
parent 11d1063452
commit 44021718a6
2 changed files with 6 additions and 6 deletions

View File

@ -885,6 +885,8 @@ void cmLocalVisualStudio6Generator
// Lookup the output directory for the target. // Lookup the output directory for the target.
std::string outPath = target.GetDirectory(); std::string outPath = target.GetDirectory();
bool targetBuilds = (target.GetType() >= cmTarget::EXECUTABLE &&
target.GetType() <= cmTarget::MODULE_LIBRARY);
#ifdef CM_USE_OLD_VS6 #ifdef CM_USE_OLD_VS6
// Lookup the library and executable output directories. // Lookup the library and executable output directories.
std::string libPath; std::string libPath;
@ -1136,8 +1138,7 @@ void cmLocalVisualStudio6Generator
} }
// Get standard libraries for this language. // Get standard libraries for this language.
if(target.GetType() >= cmTarget::EXECUTABLE && if(targetBuilds)
target.GetType() <= cmTarget::MODULE_LIBRARY)
{ {
// Get the language to use for linking. // Get the language to use for linking.
const char* linkLanguage = const char* linkLanguage =

View File

@ -627,6 +627,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
// 10 == utility // 10 == utility
const char* configType = "10"; const char* configType = "10";
const char* projectType = 0; const char* projectType = 0;
bool targetBuilds = true;
switch(target.GetType()) switch(target.GetType())
{ {
case cmTarget::STATIC_LIBRARY: case cmTarget::STATIC_LIBRARY:
@ -645,6 +646,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
case cmTarget::GLOBAL_TARGET: case cmTarget::GLOBAL_TARGET:
configType = "10"; configType = "10";
default: default:
targetBuilds = false;
break; break;
} }
if(this->FortranProject && projectType) if(this->FortranProject && projectType)
@ -801,10 +803,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n"); targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n");
fout << "\t\t\t\tAssemblerListingLocation=\"" << configName << "\"\n"; fout << "\t\t\t\tAssemblerListingLocation=\"" << configName << "\"\n";
fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"; fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n";
if(target.GetType() == cmTarget::EXECUTABLE || if(targetBuilds)
target.GetType() == cmTarget::STATIC_LIBRARY ||
target.GetType() == cmTarget::SHARED_LIBRARY ||
target.GetType() == cmTarget::MODULE_LIBRARY)
{ {
// We need to specify a program database file name even for // We need to specify a program database file name even for
// non-debug configurations because VS still creates .idb files. // non-debug configurations because VS still creates .idb files.