[Cmake-commits] CMake branch, next, updated. v3.3.0-rc4-1215-gefdeee5

Brad King brad.king at kitware.com
Tue Jul 21 14:22:42 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  efdeee5959385baa82287700b7f57200229a7fc6 (commit)
       via  45c5f8cad2f95ccfada50e1b65e56918f3c6c5c4 (commit)
      from  fb393252d7bd48943b13c1824d32bb2d753a902d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=efdeee5959385baa82287700b7f57200229a7fc6
commit efdeee5959385baa82287700b7f57200229a7fc6
Merge: fb39325 45c5f8c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Jul 21 14:22:41 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jul 21 14:22:41 2015 -0400

    Merge topic 'target-directory-properties' into next
    
    45c5f8ca Add SOURCE_DIR and BINARY_DIR target properties


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=45c5f8cad2f95ccfada50e1b65e56918f3c6c5c4
commit 45c5f8cad2f95ccfada50e1b65e56918f3c6c5c4
Author:     Clifford Yapp <cliffyapp at gmail.com>
AuthorDate: Tue Jul 21 11:57:22 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Jul 21 14:19:35 2015 -0400

    Add SOURCE_DIR and BINARY_DIR target properties
    
    This will allow project code to recover the directory information about
    where a target was created.

diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 1d27a64..ac893c2 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -114,6 +114,7 @@ Properties on Targets
    /prop_tgt/AUTOUIC_OPTIONS
    /prop_tgt/AUTORCC
    /prop_tgt/AUTORCC_OPTIONS
+   /prop_tgt/BINARY_DIR
    /prop_tgt/BUILD_WITH_INSTALL_RPATH
    /prop_tgt/BUNDLE_EXTENSION
    /prop_tgt/BUNDLE
@@ -244,6 +245,7 @@ Properties on Targets
    /prop_tgt/RUNTIME_OUTPUT_NAME_CONFIG
    /prop_tgt/RUNTIME_OUTPUT_NAME
    /prop_tgt/SKIP_BUILD_RPATH
+   /prop_tgt/SOURCE_DIR
    /prop_tgt/SOURCES
    /prop_tgt/SOVERSION
    /prop_tgt/STATIC_LIBRARY_FLAGS_CONFIG
diff --git a/Help/prop_tgt/BINARY_DIR.rst b/Help/prop_tgt/BINARY_DIR.rst
new file mode 100644
index 0000000..246f7e6
--- /dev/null
+++ b/Help/prop_tgt/BINARY_DIR.rst
@@ -0,0 +1,6 @@
+BINARY_DIR
+----------
+
+This read-only property reports the value of the
+:variable:`CMAKE_CURRENT_BINARY_DIR` variable in the directory in which
+the target was defined.
diff --git a/Help/prop_tgt/SOURCE_DIR.rst b/Help/prop_tgt/SOURCE_DIR.rst
new file mode 100644
index 0000000..b25813b
--- /dev/null
+++ b/Help/prop_tgt/SOURCE_DIR.rst
@@ -0,0 +1,6 @@
+SOURCE_DIR
+----------
+
+This read-only property reports the value of the
+:variable:`CMAKE_CURRENT_SOURCE_DIR` variable in the directory in which
+the target was defined.
diff --git a/Help/release/dev/target-directory-properties.rst b/Help/release/dev/target-directory-properties.rst
new file mode 100644
index 0000000..5ab2938
--- /dev/null
+++ b/Help/release/dev/target-directory-properties.rst
@@ -0,0 +1,5 @@
+target-directory-properties
+---------------------------
+
+* The :prop_tgt:`SOURCE_DIR` and :prop_tgt:`BINARY_DIR` target properties
+  were introduced to allow project code to query where a target is defined.
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())
diff --git a/Tests/RunCMake/get_property/target_properties-stderr.txt b/Tests/RunCMake/get_property/target_properties-stderr.txt
index d0981ac..6b3c6ca 100644
--- a/Tests/RunCMake/get_property/target_properties-stderr.txt
+++ b/Tests/RunCMake/get_property/target_properties-stderr.txt
@@ -3,4 +3,8 @@ get_property: --><--
 get_target_property: -->value<--
 get_property: -->value<--
 get_target_property: -->gtp_val-NOTFOUND<--
-get_property: --><--$
+get_property: --><--
+get_target_property: -->(.*)/Tests/RunCMake/get_property<--
+get_property: -->(.*)/Tests/RunCMake/get_property<--
+get_target_property: -->(.*)/Tests/RunCMake/get_property/target_properties-build<--
+get_property: -->(.*)/Tests/RunCMake/get_property/target_properties-build<--$
diff --git a/Tests/RunCMake/get_property/target_properties.cmake b/Tests/RunCMake/get_property/target_properties.cmake
index c5a141d..9ff833a 100644
--- a/Tests/RunCMake/get_property/target_properties.cmake
+++ b/Tests/RunCMake/get_property/target_properties.cmake
@@ -14,3 +14,5 @@ set_target_properties(tgt PROPERTIES empty "" custom value)
 check_target_property(tgt empty)
 check_target_property(tgt custom)
 check_target_property(tgt noexist)
+check_target_property(tgt SOURCE_DIR)
+check_target_property(tgt BINARY_DIR)

-----------------------------------------------------------------------

Summary of changes:
 Help/manual/cmake-properties.7.rst                       |    2 ++
 Help/prop_tgt/BINARY_DIR.rst                             |    6 ++++++
 Help/prop_tgt/SOURCE_DIR.rst                             |    6 ++++++
 Help/release/dev/target-directory-properties.rst         |    5 +++++
 Source/cmTarget.cxx                                      |   12 ++++++++++++
 Tests/RunCMake/get_property/target_properties-stderr.txt |    6 +++++-
 Tests/RunCMake/get_property/target_properties.cmake      |    2 ++
 7 files changed, 38 insertions(+), 1 deletion(-)
 create mode 100644 Help/prop_tgt/BINARY_DIR.rst
 create mode 100644 Help/prop_tgt/SOURCE_DIR.rst
 create mode 100644 Help/release/dev/target-directory-properties.rst


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list