diff options
Diffstat (limited to 'Source/cmGetTargetPropertyCommand.cxx')
-rw-r--r-- | Source/cmGetTargetPropertyCommand.cxx | 54 |
1 files changed, 8 insertions, 46 deletions
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index 9c8ed4f..45164da 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -27,56 +27,18 @@ bool cmGetTargetPropertyCommand::InitialPass( } const char* var = args[0].c_str(); const char* targetName = args[1].c_str(); - cmTargets& targets = m_Makefile->GetTargets(); - cmTargets::iterator i = targets.find(targetName); - if ( i != targets.end()) + + cmTarget *tgt = m_Makefile->GetLocalGenerator()->GetGlobalGenerator() + ->FindTarget(0,targetName); + if (tgt) { - cmTarget& target = i->second; - if ( args[2] == "LOCATION" ) + cmTarget& target = *tgt; + const char *prop = target.GetProperty(args[2].c_str()); + if (prop) { - std::string target_location; - switch( target.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: - m_Makefile->AddDefinition(var, "NOTFOUND"); - return true; - } - if ( target_location.size() == 0 ) - { - target_location += m_Makefile->GetCurrentOutputDirectory(); - } - 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 += target.GetFullName(m_Makefile); - m_Makefile->AddDefinition(var, target_location.c_str()); + m_Makefile->AddDefinition(var, prop); return true; } - else - { - const char *prop = target.GetProperty(args[2].c_str()); - if (prop) - { - m_Makefile->AddDefinition(var, prop); - return true; - } - } } m_Makefile->AddDefinition(var, "NOTFOUND"); return true; |