diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-04-27 16:03:17 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-04-27 16:03:17 (GMT) |
commit | b2bddc9f0d81d79cc3839f20ad5475ffcb393876 (patch) | |
tree | 08b5592ef343ce66354965bcfc70bbf5ecdb98a8 /Source/cmGetTargetPropertyCommand.cxx | |
parent | 5a5cd54730b586de1b2b769c2e2f32850acf0258 (diff) | |
download | CMake-b2bddc9f0d81d79cc3839f20ad5475ffcb393876.zip CMake-b2bddc9f0d81d79cc3839f20ad5475ffcb393876.tar.gz CMake-b2bddc9f0d81d79cc3839f20ad5475ffcb393876.tar.bz2 |
ENH: Add LOCATION to GET_TARGET_PROPERTY. Closes Bug #34 - Add to GET_TARGET_PROPERTY location of target
Diffstat (limited to 'Source/cmGetTargetPropertyCommand.cxx')
-rw-r--r-- | Source/cmGetTargetPropertyCommand.cxx | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index 7c35aaf..f81945e 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -32,12 +32,53 @@ bool cmGetTargetPropertyCommand::InitialPass( if ( i != targets.end()) { cmTarget& target = i->second; - const char *prop = target.GetProperty(args[2].c_str()); - if (prop) + if ( args[2] == "LOCATION" ) { - m_Makefile->AddDefinition(var, 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 += "/"; + } + + cmLocalGenerator* lg = m_Makefile->GetLocalGenerator(); + target_location += lg->GetFullTargetName(targetName, target); + m_Makefile->AddDefinition(var, target_location.c_str()); return true; } + else + { + const char *prop = 0; + prop = target.GetProperty(args[2].c_str()); + if (prop) + { + m_Makefile->AddDefinition(var, prop); + return true; + } + } } m_Makefile->AddDefinition(var, "NOTFOUND"); return true; |