From 1829bed8b5dd4c1d3b622a14160d3a6706bcc16e Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 7 Apr 2008 13:39:13 -0400 Subject: BUG: Do not create target output directory in cmTarget. Let the generators do it. --- Source/cmMakefileExecutableTargetGenerator.cxx | 2 ++ Source/cmMakefileLibraryTargetGenerator.cxx | 2 ++ Source/cmTarget.cxx | 22 +++------------------- Source/cmTarget.h | 3 --- 4 files changed, 7 insertions(+), 22 deletions(-) diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 1715fe9..29be46c 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -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 += "/"; } } diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 1c7f108..94947f0 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -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 += "/"; } } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index aa4c403..9c10e36 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -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,28 +2987,12 @@ 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() { // Define the symbol for targets that export symbols. diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f90a059..658ea98 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -464,9 +464,6 @@ private: 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); const char* ImportedGetLocation(const char* config); -- cgit v0.12