From 5792dc8da8a567ece9fd231e9844a5b1cd30ddc2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 3 Mar 2006 18:06:44 -0500 Subject: ENH: Replaced UpdateLocation method with call to GetLocation. Added comment about problems with the LOCATION attribute. --- Source/cmTarget.cxx | 54 ++++++++++------------------------------------------- Source/cmTarget.h | 3 --- 2 files changed, 10 insertions(+), 47 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a562f25..39cdbae 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -859,56 +859,22 @@ const char* cmTarget::GetLocation(const char* config) return m_Location.c_str(); } -void cmTarget::UpdateLocation() -{ - // make sure we have a makefile - if (!m_Makefile) - { - return; - } - - // set the LOCATION property of the target - std::string target_location; - switch( this->GetType() ) - { - case cmTarget::STATIC_LIBRARY: - case cmTarget::MODULE_LIBRARY: - case cmTarget::SHARED_LIBRARY: - target_location = - m_Makefile->GetSafeDefinition("LIBRARY_OUTPUT_PATH"); - break; - case cmTarget::EXECUTABLE: - target_location = - m_Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); - break; - default: - return; - } - if ( target_location.size() == 0 ) - { - target_location += m_Makefile->GetStartOutputDirectory(); - } - if ( target_location.size() > 0 ) - { - target_location += "/"; - } - const char* cfgid = m_Makefile->GetDefinition("CMAKE_CFG_INTDIR"); - if ( cfgid && strcmp(cfgid, ".") != 0 ) - { - target_location += cfgid; - target_location += "/"; - } - target_location += this->GetFullName(); - this->SetProperty("LOCATION",target_location.c_str()); -} - const char *cmTarget::GetProperty(const char* prop) { // watch for special "computed" properties that are dependent on other // properties or variables, always recompute them if (!strcmp(prop,"LOCATION")) { - this->UpdateLocation(); + // Set the LOCATION property of the target. Note that this cannot take + // into account the per-configuration name of the target because the + // configuration type may not be known at CMake time. We should + // deprecate this feature and instead support transforming an executable + // target name given as the command part of custom commands into the + // proper path at build time. Alternatively we could put environment + // variable settings in all custom commands that hold the name of the + // target for each configuration and then give a reference to the + // variable in the location. + this->SetProperty("LOCATION", this->GetLocation(0)); } // the type property returns what type the target is diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 9990cdd..d22df65 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -306,9 +306,6 @@ private: TargetType type, const char* config); - // update the value of the LOCATION var - void UpdateLocation(); - // Use a makefile variable to set a default for the given property. // If the variable is not defined use the given default instead. void SetPropertyDefault(const char* property, const char* default_value); -- cgit v0.12