diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 2bfc0374e..b083ba1af 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -43,6 +43,11 @@ public: std::map Objects; std::set ExplicitObjectName; + /** Full path with trailing slash to the top-level directory + holding object files for this target. Includes the build + time config name placeholder if needed for the generator. */ + std::string ObjectDirectory; + private: void ClassifySources(); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 059692ed1..9d8a02cb8 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -86,6 +86,7 @@ cmGlobalUnixMakefileGenerator3 dir_max += "/"; dir_max += gt->LocalGenerator->GetTargetDirectory(*target); dir_max += "/"; + gt->ObjectDirectory = dir_max; // Compute the name of each object file. for(std::vector::iterator diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index e5a978459..4b9e48791 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -139,6 +139,22 @@ cmGlobalVisualStudioGenerator } gt->Objects[sf] = objectName; } + + std::string dir = gt->Makefile->GetCurrentOutputDirectory(); + dir += "/"; + std::string tgtDir = lg->GetTargetDirectory(*gt->Target); + if(!tgtDir.empty()) + { + dir += tgtDir; + dir += "/"; + } + const char* cd = this->GetCMakeCFGIntDir(); + if(cd && *cd) + { + dir += cd; + dir += "/"; + } + gt->ObjectDirectory = dir; } //----------------------------------------------------------------------------