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
{
cmSystemTools::MakeDirectory(outpath.c_str());
if(!targetNameImport.empty())
{
outpathImp = this->Target->GetDirectory(0, true);
cmSystemTools::MakeDirectory(outpathImp.c_str());
outpathImp += "/";
}
}

View File

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

View File

@ -1653,7 +1653,7 @@ const char* cmTarget::NormalGetDirectory(const char* config, bool implib)
if(config && *config)
{
// 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.
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
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
// libraries, and executables.
@ -2862,7 +2862,7 @@ const char* cmTarget::GetAndCreateOutputDir(bool implib, bool create)
if(implib &&
!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: ";
msg += this->GetName();
this->GetMakefile()->
@ -2987,27 +2987,11 @@ const char* cmTarget::GetAndCreateOutputDir(bool implib, bool create)
out += this->GetFullName(0, implib);
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();
}
//----------------------------------------------------------------------------
const char* cmTarget::GetOutputDir(bool implib)
{
return this->GetAndCreateOutputDir(implib, true);
}
//----------------------------------------------------------------------------
const char* cmTarget::GetExportMacro()
{

View File

@ -463,9 +463,6 @@ private:
// If the variable is not defined use the given default instead.
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.
const char* GetOutputDir(bool implib);