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  f79c8a9fa000f7e3b4cdb984cd91a709cb42bce6 (commit)
       via  b1dc4ddbdd651e8bdd30878fa9afc840d97c9114 (commit)
      from  3ae275f4f8a4dcf6721c0112b7d4cfcb9366a35e (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=f79c8a9fa000f7e3b4cdb984cd91a709cb42bce6
commit f79c8a9fa000f7e3b4cdb984cd91a709cb42bce6
Merge: 3ae275f b1dc4dd
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Tue Jan 10 10:57:19 2017 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Tue Jan 10 10:57:19 2017 -0500

    Merge topic 'BundleUtilities-symlink-structure' into next
    
    b1dc4ddb BundleUtilities: Maintain symlink structure


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b1dc4ddbdd651e8bdd30878fa9afc840d97c9114
commit b1dc4ddbdd651e8bdd30878fa9afc840d97c9114
Author:     Martin Koegler <martin.koeg...@chello.at>
AuthorDate: Fri Dec 9 21:55:22 2016 +0100
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Tue Jan 10 10:55:41 2017 -0500

    BundleUtilities: Maintain symlink structure
    
    Closes: #15047

diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index b1610e2..5d6f402 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -624,6 +624,33 @@ function(get_bundle_keys app libs dirs keys_var)
       endif()
     endforeach()
 
+    # preserve library symlink structure
+    foreach(key ${${keys_var}})
+      if("${${key}_COPYFLAG}" STREQUAL 1)
+        if(IS_SYMLINK "${${key}_RESOLVED_ITEM}")
+          get_filename_component(target "${${key}_RESOLVED_ITEM}" REALPATH)
+          set_bundle_key_values(${keys_var} "${exe}" "${target}" "${exepath}" 
"${dirs}" 1 "${exe_rpaths}")
+          get_item_key("${target}" targetkey)
+
+          if(WIN32)
+            # ignore case on Windows
+            string(TOLOWER "${${key}_RESOLVED_ITEM}" resolved_item_compare)
+            string(TOLOWER "${${targetkey}_RESOLVED_EMBEDDED_ITEM}" 
resolved_embedded_item_compare)
+          else()
+            set(resolved_item_compare "${${key}_RESOLVED_ITEM}")
+            set(resolved_embedded_item_compare 
"${${targetkey}_RESOLVED_EMBEDDED_ITEM}")
+          endif()
+          get_filename_component(resolved_item_compare 
"${resolved_item_compare}" NAME)
+          get_filename_component(resolved_embedded_item_compare 
"${resolved_embedded_item_compare}" NAME)
+
+          if(NOT "${resolved_item_compare}" STREQUAL 
"${resolved_embedded_item_compare}")
+            set(${key}_COPYFLAG "2")
+            set(${key}_RESOLVED_ITEM "${${targetkey}_RESOLVED_EMBEDDED_ITEM}")
+          endif()
+
+        endif()
+      endif()
+    endforeach()
     # Propagate values to caller's scope:
     #
     set(${keys_var} ${${keys_var}} PARENT_SCOPE)
@@ -640,6 +667,24 @@ function(get_bundle_keys app libs dirs keys_var)
   endif()
 endfunction()
 
+function(link_resolved_item_into_bundle resolved_item resolved_embedded_item)
+  if(WIN32)
+    # ignore case on Windows
+    string(TOLOWER "${resolved_item}" resolved_item_compare)
+    string(TOLOWER "${resolved_embedded_item}" resolved_embedded_item_compare)
+  else()
+    set(resolved_item_compare "${resolved_item}")
+    set(resolved_embedded_item_compare "${resolved_embedded_item}")
+  endif()
+
+  if("${resolved_item_compare}" STREQUAL "${resolved_embedded_item_compare}")
+    message(STATUS "warning: resolved_item == resolved_embedded_item - not 
linking...")
+  else()
+    get_filename_component(target_dir "${resolved_embedded_item}" DIRECTORY)
+    file(RELATIVE_PATH symlink_target "${target_dir}" "${resolved_item}")
+    execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
"${symlink_target}" "${resolved_embedded_item}")
+  endif()
+endfunction()
 
 function(copy_resolved_item_into_bundle resolved_item resolved_embedded_item)
   if(WIN32)
@@ -854,7 +899,9 @@ function(fixup_bundle app libs dirs)
     set(i 0)
     foreach(key ${keys})
       math(EXPR i ${i}+1)
-      if(${${key}_COPYFLAG})
+      if("${${key}_COPYFLAG}" STREQUAL "2")
+        message(STATUS "${i}/${n}: linking '${${key}_RESOLVED_ITEM}' -> 
'${${key}_RESOLVED_EMBEDDED_ITEM}'")
+      elseif(${${key}_COPYFLAG})
         message(STATUS "${i}/${n}: copying '${${key}_RESOLVED_ITEM}'")
       else()
         message(STATUS "${i}/${n}: *NOT* copying '${${key}_RESOLVED_ITEM}'")
@@ -872,7 +919,10 @@ function(fixup_bundle app libs dirs)
         message(STATUS "")
       endif()
 
-      if(${${key}_COPYFLAG})
+      if("${${key}_COPYFLAG}" STREQUAL "2")
+        link_resolved_item_into_bundle("${${key}_RESOLVED_ITEM}"
+          "${${key}_RESOLVED_EMBEDDED_ITEM}")
+      elseif(${${key}_COPYFLAG})
         set(item "${${key}_ITEM}")
         if(item MATCHES "[^/]+\\.framework/")
           copy_resolved_framework_into_bundle("${${key}_RESOLVED_ITEM}"
@@ -889,7 +939,9 @@ function(fixup_bundle app libs dirs)
       math(EXPR i ${i}+1)
       if(APPLE)
         message(STATUS "${i}/${n}: fixing up 
'${${key}_RESOLVED_EMBEDDED_ITEM}'")
-        fixup_bundle_item("${${key}_RESOLVED_EMBEDDED_ITEM}" "${exepath}" 
"${dirs}")
+        if(NOT "${${key}_COPYFLAG}" STREQUAL "2")
+          fixup_bundle_item("${${key}_RESOLVED_EMBEDDED_ITEM}" "${exepath}" 
"${dirs}")
+        endif()
       else()
         message(STATUS "${i}/${n}: fix-up not required on this platform 
'${${key}_RESOLVED_EMBEDDED_ITEM}'")
       endif()

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

Summary of changes:
 Modules/BundleUtilities.cmake |   58 ++++++++++++++++++++++++++++++++++++++---
 1 file changed, 55 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to