BUG: Avoid cmTarget::GetDirectory for utilities

Since utility targets have no main output files like executables or
libraries, they do not define an output directory.  This removes a call
to cmTarget::GetDirectory from cmLocalVisualStudio{6,7}Generator for
such targets.
This commit is contained in:
Brad King 2009-07-03 10:33:49 -04:00
parent 44021718a6
commit 43669f0ef2
3 changed files with 10 additions and 12 deletions

View File

@ -882,9 +882,6 @@ void cmLocalVisualStudio6Generator
const char *libName, cmTarget &target, const char *libName, cmTarget &target,
std::vector<cmSourceGroup> &) std::vector<cmSourceGroup> &)
{ {
// Lookup the output directory for the target.
std::string outPath = target.GetDirectory();
bool targetBuilds = (target.GetType() >= cmTarget::EXECUTABLE && bool targetBuilds = (target.GetType() >= cmTarget::EXECUTABLE &&
target.GetType() <= cmTarget::MODULE_LIBRARY); target.GetType() <= cmTarget::MODULE_LIBRARY);
#ifdef CM_USE_OLD_VS6 #ifdef CM_USE_OLD_VS6
@ -1415,10 +1412,15 @@ void cmLocalVisualStudio6Generator
removeQuotes(this->ConvertToOptionallyRelativeOutputPath removeQuotes(this->ConvertToOptionallyRelativeOutputPath
(exePath.c_str())).c_str()); (exePath.c_str())).c_str());
#endif #endif
cmSystemTools::ReplaceString
(line, "OUTPUT_DIRECTORY", if(targetBuilds)
removeQuotes(this->ConvertToOptionallyRelativeOutputPath {
(outPath.c_str())).c_str()); std::string outPath = target.GetDirectory();
cmSystemTools::ReplaceString
(line, "OUTPUT_DIRECTORY",
removeQuotes(this->ConvertToOptionallyRelativeOutputPath
(outPath.c_str())).c_str());
}
cmSystemTools::ReplaceString(line, cmSystemTools::ReplaceString(line,
"EXTRA_DEFINES", "EXTRA_DEFINES",

View File

@ -864,7 +864,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
// end of <Tool Name=VCMIDLTool // end of <Tool Name=VCMIDLTool
// Check if we need the FAT32 workaround. // Check if we need the FAT32 workaround.
if ( this->Version >= 8 ) if(targetBuilds && this->Version >= 8)
{ {
// Check the filesystem type where the target will be written. // Check the filesystem type where the target will be written.
if(cmLVS6G_IsFAT(target.GetDirectory(configName).c_str())) if(cmLVS6G_IsFAT(target.GetDirectory(configName).c_str()))

View File

@ -38,7 +38,6 @@ MTL=midl.exe
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir "OUTPUT_DIRECTORY\Release"
# PROP Intermediate_Dir "Release" # PROP Intermediate_Dir "Release"
# PROP Target_Dir "" # PROP Target_Dir ""
@ -53,7 +52,6 @@ CMAKE_CUSTOM_RULE_CODE_RELEASE
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 1 # PROP Use_Debug_Libraries 1
# PROP Output_Dir "OUTPUT_DIRECTORY\Debug"
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
@ -68,7 +66,6 @@ CMAKE_CUSTOM_RULE_CODE_DEBUG
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir "OUTPUT_DIRECTORY\MinSizeRel"
# PROP Intermediate_Dir "MinSizeRel" # PROP Intermediate_Dir "MinSizeRel"
# PROP Target_Dir "" # PROP Target_Dir ""
@ -83,7 +80,6 @@ CMAKE_CUSTOM_RULE_CODE_MINSIZEREL
# PROP BASE Target_Dir "" # PROP BASE Target_Dir ""
# PROP Use_MFC 0 # PROP Use_MFC 0
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir "OUTPUT_DIRECTORY\RelWithDebInfo"
# PROP Intermediate_Dir "RelWithDebInfo" # PROP Intermediate_Dir "RelWithDebInfo"
# PROP Target_Dir "" # PROP Target_Dir ""