summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorClifford Yapp <cliffyapp@gmail.com>2015-07-21 15:57:22 (GMT)
committerBrad King <brad.king@kitware.com>2015-07-21 18:19:35 (GMT)
commit45c5f8cad2f95ccfada50e1b65e56918f3c6c5c4 (patch)
tree8fbe532a2e45676c346f9c16a8500bede7c413fa /Source
parent265b9db7c2c865c5aad821bf9a377ea84dfe431e (diff)
downloadCMake-45c5f8cad2f95ccfada50e1b65e56918f3c6c5c4.zip
CMake-45c5f8cad2f95ccfada50e1b65e56918f3c6c5c4.tar.gz
CMake-45c5f8cad2f95ccfada50e1b65e56918f3c6c5c4.tar.bz2
Add SOURCE_DIR and BINARY_DIR target properties
This will allow project code to recover the directory information about where a target was created.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTarget.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 46e9ed4..3d8adae 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2959,6 +2959,8 @@ const char *cmTarget::GetProperty(const std::string& prop,
MAKE_STATIC_PROP(COMPILE_DEFINITIONS);
MAKE_STATIC_PROP(IMPORTED);
MAKE_STATIC_PROP(NAME);
+ MAKE_STATIC_PROP(BINARY_DIR);
+ MAKE_STATIC_PROP(SOURCE_DIR);
MAKE_STATIC_PROP(SOURCES);
#undef MAKE_STATIC_PROP
if(specialProps.empty())
@@ -2971,6 +2973,8 @@ const char *cmTarget::GetProperty(const std::string& prop,
specialProps.insert(propCOMPILE_DEFINITIONS);
specialProps.insert(propIMPORTED);
specialProps.insert(propNAME);
+ specialProps.insert(propBINARY_DIR);
+ specialProps.insert(propSOURCE_DIR);
specialProps.insert(propSOURCES);
}
if(specialProps.count(prop))
@@ -3053,6 +3057,14 @@ const char *cmTarget::GetProperty(const std::string& prop,
{
return this->GetName().c_str();
}
+ else if (prop == propBINARY_DIR)
+ {
+ return this->GetMakefile()->GetCurrentBinaryDirectory();
+ }
+ else if (prop == propSOURCE_DIR)
+ {
+ return this->GetMakefile()->GetCurrentSourceDirectory();
+ }
else if(prop == propSOURCES)
{
if (this->Internal->SourceEntries.empty())