diff options
author | Ken Martin <ken.martin@kitware.com> | 2005-06-20 18:00:48 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2005-06-20 18:00:48 (GMT) |
commit | 26c53fe14c4d6cabb8b7476f5c19ca7088199841 (patch) | |
tree | 0a21177b04547b365a0c82a52979315cb4adcd97 /Source/cmGetTargetPropertyCommand.cxx | |
parent | 490119d2aa31eaaeb99a145ab3e7b2aee2c957db (diff) | |
download | CMake-26c53fe14c4d6cabb8b7476f5c19ca7088199841.zip CMake-26c53fe14c4d6cabb8b7476f5c19ca7088199841.tar.gz CMake-26c53fe14c4d6cabb8b7476f5c19ca7088199841.tar.bz2 |
ENH: modified GET_TARGET_PROPERTIES to work with all targets
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; |