[Cmake-commits] CMake branch, next, updated. v3.6.2-1312-ge6cd89b

Brad King brad.king at kitware.com
Mon Oct 3 13:39:56 EDT 2016


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  e6cd89b6b31760c5aee1aa0ae354014cd4b498e8 (commit)
       via  886a61ae304afd7c28362c19ea5c539e686d6760 (commit)
      from  6051f76a0f28c91d36d51d132dc723778577d053 (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e6cd89b6b31760c5aee1aa0ae354014cd4b498e8
commit e6cd89b6b31760c5aee1aa0ae354014cd4b498e8
Merge: 6051f76 886a61a
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Oct 3 13:39:54 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Oct 3 13:39:54 2016 -0400

    Merge topic 'add-BUILD_RPATH' into next
    
    886a61ae Add a BUILD_RPATH target property specifying build-tree RPATH entries


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=886a61ae304afd7c28362c19ea5c539e686d6760
commit 886a61ae304afd7c28362c19ea5c539e686d6760
Author:     Ruslan Baratov <ruslan_baratov at yahoo.com>
AuthorDate: Sat Oct 1 02:30:57 2016 +0300
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Oct 3 13:31:46 2016 -0400

    Add a BUILD_RPATH target property specifying build-tree RPATH entries
    
    Users may need to add custom `RPATH` entries to be able to run binaries
    from their build tree without setting `LD_LIBRARY_PATH`.  Provide a way
    to do this that does not affect the install-tree `RPATH`.

diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 271f497..fa21a1f 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -121,6 +121,7 @@ Properties on Targets
    /prop_tgt/AUTORCC
    /prop_tgt/AUTORCC_OPTIONS
    /prop_tgt/BINARY_DIR
+   /prop_tgt/BUILD_RPATH
    /prop_tgt/BUILD_WITH_INSTALL_RPATH
    /prop_tgt/BUNDLE_EXTENSION
    /prop_tgt/BUNDLE
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index b74f867..f76c467 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -257,6 +257,7 @@ Variables that Control the Build
    /variable/CMAKE_AUTORCC_OPTIONS
    /variable/CMAKE_AUTOUIC
    /variable/CMAKE_AUTOUIC_OPTIONS
+   /variable/CMAKE_BUILD_RPATH
    /variable/CMAKE_BUILD_WITH_INSTALL_RPATH
    /variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY
    /variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
diff --git a/Help/prop_tgt/BUILD_RPATH.rst b/Help/prop_tgt/BUILD_RPATH.rst
new file mode 100644
index 0000000..27393f5
--- /dev/null
+++ b/Help/prop_tgt/BUILD_RPATH.rst
@@ -0,0 +1,10 @@
+BUILD_RPATH
+-----------
+
+A :ref:`;-list <CMake Language Lists>` specifying runtime path (``RPATH``)
+entries to add to binaries linked in the build tree (for platforms that
+support it).  The entries will *not* be used for binaries in the install
+tree.  See also the :prop_tgt:`INSTALL_RPATH` target property.
+
+This property is initialized by the value of the variable
+:variable:`CMAKE_BUILD_RPATH` if it is set when a target is created.
diff --git a/Help/release/dev/add-BUILD_RPATH.rst b/Help/release/dev/add-BUILD_RPATH.rst
new file mode 100644
index 0000000..0d69e45
--- /dev/null
+++ b/Help/release/dev/add-BUILD_RPATH.rst
@@ -0,0 +1,6 @@
+add-BUILD_RPATH
+---------------
+
+* A :variable:`CMAKE_BUILD_RPATH` variable and corresponding
+  :prop_tgt:`BUILD_RPATH` target property were added to support custom
+  ``RPATH`` locations to be added to binaries in the build tree.
diff --git a/Help/variable/CMAKE_BUILD_RPATH.rst b/Help/variable/CMAKE_BUILD_RPATH.rst
new file mode 100644
index 0000000..f20eb41
--- /dev/null
+++ b/Help/variable/CMAKE_BUILD_RPATH.rst
@@ -0,0 +1,10 @@
+CMAKE_BUILD_RPATH
+-----------------
+
+A :ref:`;-list <CMake Language Lists>` specifying runtime path (``RPATH``)
+entries to add to binaries linked in the build tree (for platforms that
+support it).  The entries will *not* be used for binaries in the install
+tree.  See also the :variable:`CMAKE_INSTALL_RPATH` variable.
+
+This is used to initialize the :prop_tgt:`BUILD_RPATH` target property
+for all targets.
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index dc8236d..0807ef8 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1710,6 +1710,12 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
     const char* install_rpath = this->Target->GetProperty("INSTALL_RPATH");
     cmCLI_ExpandListUnique(install_rpath, runtimeDirs, emitted);
   }
+  if (use_build_rpath) {
+    // Add directories explicitly specified by user
+    if (const char* build_rpath = this->Target->GetProperty("BUILD_RPATH")) {
+      cmCLI_ExpandListUnique(build_rpath, runtimeDirs, emitted);
+    }
+  }
   if (use_build_rpath || use_link_rpath) {
     std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
     const char* stagePath =
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index e8d66a2..7eb0ebf 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -4965,6 +4965,9 @@ bool cmGeneratorTarget::HaveBuildTreeRPATH(const std::string& config) const
   if (this->GetPropertyAsBool("SKIP_BUILD_RPATH")) {
     return false;
   }
+  if (this->GetProperty("BUILD_RPATH")) {
+    return true;
+  }
   if (cmLinkImplementationLibraries const* impl =
         this->GetLinkImplementationLibraries(config)) {
     return !impl->Libraries.empty();
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 54e0bea..cb6abb3 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -102,6 +102,7 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type,
     this->SetPropertyDefault("ANDROID_JAR_DEPENDENCIES", CM_NULLPTR);
     this->SetPropertyDefault("ANDROID_ASSETS_DIRECTORIES", CM_NULLPTR);
     this->SetPropertyDefault("ANDROID_ANT_ADDITIONAL_OPTIONS", CM_NULLPTR);
+    this->SetPropertyDefault("BUILD_RPATH", "");
     this->SetPropertyDefault("INSTALL_NAME_DIR", CM_NULLPTR);
     this->SetPropertyDefault("INSTALL_RPATH", "");
     this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF");
diff --git a/Tests/MacRuntimePath/A/CMakeLists.txt b/Tests/MacRuntimePath/A/CMakeLists.txt
index ade0a3c..bf937e6 100644
--- a/Tests/MacRuntimePath/A/CMakeLists.txt
+++ b/Tests/MacRuntimePath/A/CMakeLists.txt
@@ -40,21 +40,30 @@ target_link_libraries(test3 framework)
 add_executable(test4 test1.cpp)
 target_link_libraries(test4 shared2)
 
+# executable to test a shared library dependency with build rpath
+add_executable(test5 test1.cpp)
+
+# avoid linking by 'target_link_libraries' so CMake
+# will not be able to set correct RPATH automatically
+add_dependencies(test5 shared)
+target_link_libraries(test5 "$<TARGET_FILE:shared>")
+set_target_properties(test5 PROPERTIES BUILD_RPATH "@loader_path/../lib")
+
 set_target_properties(shared shared2 framework PROPERTIES
   LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib")
-set_target_properties(test1 test2 test3 test4 PROPERTIES
+set_target_properties(test1 test2 test3 test4 test5 PROPERTIES
   RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
 foreach(config ${CMAKE_CONFIGURATION_TYPES})
   string(TOUPPER ${config} CONFIG)
   set_target_properties(shared shared2 framework PROPERTIES
     LIBRARY_OUTPUT_DIRECTORY_${CONFIG}
       "${CMAKE_CURRENT_BINARY_DIR}/${config}/lib")
-  set_target_properties(test1 test2 test3 test4 PROPERTIES
+  set_target_properties(test1 test2 test3 test4 test5 PROPERTIES
     RUNTIME_OUTPUT_DIRECTORY_${CONFIG}
       "${CMAKE_CURRENT_BINARY_DIR}/${config}/bin")
 endforeach()
 
-foreach(test test1 test2 test3 test4)
+foreach(test test1 test2 test3 test4 test5)
   add_custom_target(${test}_run  ALL
     COMMAND ${test}
     DEPENDS ${test}

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

Summary of changes:
 Help/manual/cmake-properties.7.rst    |    1 +
 Help/manual/cmake-variables.7.rst     |    1 +
 Help/prop_tgt/BUILD_RPATH.rst         |   10 ++++++++++
 Help/release/dev/add-BUILD_RPATH.rst  |    6 ++++++
 Help/variable/CMAKE_BUILD_RPATH.rst   |   10 ++++++++++
 Source/cmComputeLinkInformation.cxx   |    6 ++++++
 Source/cmGeneratorTarget.cxx          |    3 +++
 Source/cmTarget.cxx                   |    1 +
 Tests/MacRuntimePath/A/CMakeLists.txt |   15 ++++++++++++---
 9 files changed, 50 insertions(+), 3 deletions(-)
 create mode 100644 Help/prop_tgt/BUILD_RPATH.rst
 create mode 100644 Help/release/dev/add-BUILD_RPATH.rst
 create mode 100644 Help/variable/CMAKE_BUILD_RPATH.rst


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list