diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 1715fe96f..29be46ce7 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 1c7f10841..94947f0dc 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 aa4c403ce..9c10e363e 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,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() { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f90a05978..658ea98f9 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -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);