BUG: Do not create target output directory in cmTarget. Let the generators do it.

This commit is contained in:
Brad King 2008-04-07 13:39:13 -04:00
parent fcd09ca90f
commit 1829bed8b5
4 changed files with 7 additions and 22 deletions

View File

@ -147,9 +147,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
} }
else else
{ {
cmSystemTools::MakeDirectory(outpath.c_str());
if(!targetNameImport.empty()) if(!targetNameImport.empty())
{ {
outpathImp = this->Target->GetDirectory(0, true); outpathImp = this->Target->GetDirectory(0, true);
cmSystemTools::MakeDirectory(outpathImp.c_str());
outpathImp += "/"; outpathImp += "/";
} }
} }

View File

@ -369,10 +369,12 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
else else
{ {
outpath = this->Target->GetDirectory(); outpath = this->Target->GetDirectory();
cmSystemTools::MakeDirectory(outpath.c_str());
outpath += "/"; outpath += "/";
if(!targetNameImport.empty()) if(!targetNameImport.empty())
{ {
outpathImp = this->Target->GetDirectory(0, true); outpathImp = this->Target->GetDirectory(0, true);
cmSystemTools::MakeDirectory(outpathImp.c_str());
outpathImp += "/"; outpathImp += "/";
} }
} }

View File

@ -1653,7 +1653,7 @@ const char* cmTarget::NormalGetDirectory(const char* config, bool implib)
if(config && *config) if(config && *config)
{ {
// Do not create the directory when config is given: // Do not create the directory when config is given:
this->Directory = this->GetAndCreateOutputDir(implib, true); this->Directory = this->GetOutputDir(implib);
// Add the configuration's subdirectory. // Add the configuration's subdirectory.
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
AppendDirectoryForConfig("/", config, "", this->Directory); AppendDirectoryForConfig("/", config, "", this->Directory);
@ -2845,7 +2845,7 @@ std::string cmTarget::GetInstallNameDirForInstallTree(const char*)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* cmTarget::GetAndCreateOutputDir(bool implib, bool create) const char* cmTarget::GetOutputDir(bool implib)
{ {
// The implib option is only allowed for shared libraries, module // The implib option is only allowed for shared libraries, module
// libraries, and executables. // libraries, and executables.
@ -2862,7 +2862,7 @@ const char* cmTarget::GetAndCreateOutputDir(bool implib, bool create)
if(implib && if(implib &&
!this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) !this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"))
{ {
std::string msg = "GetAndCreateOutputDir, imlib set but there is no " std::string msg = "GetOutputDir, imlib set but there is no "
"CMAKE_IMPORT_LIBRARY_SUFFIX for target: "; "CMAKE_IMPORT_LIBRARY_SUFFIX for target: ";
msg += this->GetName(); msg += this->GetName();
this->GetMakefile()-> this->GetMakefile()->
@ -2987,27 +2987,11 @@ const char* cmTarget::GetAndCreateOutputDir(bool implib, bool create)
out += this->GetFullName(0, implib); out += this->GetFullName(0, implib);
out += ".framework"; out += ".framework";
} }
// Optionally make sure the output path exists on disk.
if(create)
{
if(!cmSystemTools::MakeDirectory(out.c_str()))
{
cmSystemTools::Error("Error failed to create output directory: ",
out.c_str());
}
}
} }
return out.c_str(); return out.c_str();
} }
//----------------------------------------------------------------------------
const char* cmTarget::GetOutputDir(bool implib)
{
return this->GetAndCreateOutputDir(implib, true);
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* cmTarget::GetExportMacro() const char* cmTarget::GetExportMacro()
{ {

View File

@ -463,9 +463,6 @@ private:
// If the variable is not defined use the given default instead. // If the variable is not defined use the given default instead.
void SetPropertyDefault(const char* property, const char* default_value); void SetPropertyDefault(const char* property, const char* default_value);
// Get the full path to the target output directory.
const char* GetAndCreateOutputDir(bool implib, bool create);
// Get the full path to the target output directory. // Get the full path to the target output directory.
const char* GetOutputDir(bool implib); const char* GetOutputDir(bool implib);