From afa83678854b7af547c9f0033ac5f7446a163447 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 3 Feb 2006 11:36:11 -0500 Subject: BUG: Fixed cmTarget::GetFullPath to not append the configuration name when only one configuration is built. It now asks the generator what subdirectory if any to use for a given configuration name. --- Source/cmGlobalGenerator.cxx | 8 ++++++++ Source/cmGlobalGenerator.h | 3 +++ Source/cmGlobalVisualStudio6Generator.cxx | 12 ++++++++++++ Source/cmGlobalVisualStudio6Generator.h | 4 ++++ Source/cmGlobalVisualStudio7Generator.cxx | 12 ++++++++++++ Source/cmGlobalVisualStudio7Generator.h | 3 +++ Source/cmGlobalXCodeGenerator.cxx | 15 +++++++++++++++ Source/cmTarget.cxx | 13 ++++--------- 8 files changed, 61 insertions(+), 9 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 8a976ab..0f965eb 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1183,3 +1183,11 @@ void cmGlobalGenerator::SetupTests() } } } + +//---------------------------------------------------------------------------- +void cmGlobalGenerator::AppendDirectoryForConfig(const char*, std::string&) +{ + // Subclasses that support multiple configurations should implement + // this method to append the subdirectory for the given build + // configuration. +} diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index d11f8fb..0899152 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -149,6 +149,9 @@ public: ///! Find a local generator by its startdirectory cmLocalGenerator* FindLocalGenerator(const char* start_dir); + /** Append the subdirectory for the given configuration. */ + virtual void AppendDirectoryForConfig(const char* config, std::string& dir); + protected: // Fill the m_ProjectMap, this must be called after m_LocalGenerators has been populated. void FillProjectMap(); diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 11dbff2..5781bff 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -486,3 +486,15 @@ void cmGlobalVisualStudio6Generator::GetDocumentation(cmDocumentationEntry& entr entry.brief = "Generates Visual Studio 6 project files."; entry.full = ""; } + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio6Generator +::AppendDirectoryForConfig(const char* config, std::string& dir) +{ + if(config) + { + dir += "/"; + dir += config; + } +} diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 1d9b56d..687ab8a 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -74,6 +74,10 @@ public: virtual void WriteDSWFile(std::ostream& fout, cmLocalGenerator* root, std::vector& generators); + + /** Append the subdirectory for the given configuration. */ + virtual void AppendDirectoryForConfig(const char* config, std::string& dir); + private: void GenerateConfigurations(cmMakefile* mf); void WriteDSWFile(std::ostream& fout); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index a5d5735..5e3eb3b 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -718,3 +718,15 @@ void cmGlobalVisualStudio7Generator::Configure() this->CreateGUID("INSTALL"); this->CreateGUID("RUN_TESTS"); } + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio7Generator +::AppendDirectoryForConfig(const char* config, std::string& dir) +{ + if(config) + { + dir += "/"; + dir += config; + } +} diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index eb55bd2..7ef7d32 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -81,6 +81,9 @@ public: ///! do configure step virtual void Configure(); + /** Append the subdirectory for the given configuration. */ + virtual void AppendDirectoryForConfig(const char* config, std::string& dir); + protected: virtual void OutputSLNFile(cmLocalGenerator* root, std::vector& generators); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0879224..51c5687 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2284,3 +2284,18 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const char* p) } return ret; } + +//---------------------------------------------------------------------------- +void +cmGlobalXCodeGenerator +::AppendDirectoryForConfig(const char* config, std::string& dir) +{ + if(m_XcodeVersion > 20) + { + if(config) + { + dir += "/"; + dir += config; + } + } +} diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c5471b8..58a40b3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1054,18 +1054,13 @@ std::string cmTarget::GetFullPath(const char* config) { // Start with the output directory for the target. std::string fpath = this->GetDirectory(); - fpath += "/"; - // Add the configuration's subdirectory. This may need to be replaced with - // a call into the generator found through m_Makefile so that each - // generator can map configuration names to output directories its own way. - if(config) - { - fpath += config; - fpath += "/"; - } + // Add the configuration's subdirectory. + m_Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + AppendDirectoryForConfig(config, fpath); // Add the full name of the target. + fpath += "/"; fpath += this->GetFullName(config); return fpath; } -- cgit v0.12