[Cmake-commits] CMake branch, master, updated. v3.13.2-807-g99a0a6d

Kitware Robot kwrobot at kitware.com
Sun Jan 6 15:13:05 EST 2019


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, master has been updated
       via  99a0a6d8163f27daf08e53da95b8c685bcd5189e (commit)
       via  08be74bfd7e24af9ffdb64dddffd3d56bf52c3ce (commit)
       via  52445300d67df73b5b8c288cc33c915053c7ba24 (commit)
       via  1bac4678eaf7beefb12ad91ecdea0e551b4d0fcf (commit)
       via  5072598f0795f44e157bef8423feda7de24c5504 (commit)
       via  428680da92b98755be1a908ee4a5d705d8753bb9 (commit)
      from  d3e0e65de3dc8fbc8b96ef9780bffe7390bf6b70 (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=99a0a6d8163f27daf08e53da95b8c685bcd5189e
commit 99a0a6d8163f27daf08e53da95b8c685bcd5189e
Merge: d3e0e65 08be74b
Author:     Craig Scott <craig.scott at crascit.com>
AuthorDate: Sun Jan 6 20:05:18 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Sun Jan 6 15:05:32 2019 -0500

    Merge topic 'bundle_fixes'
    
    08be74bfd7 GetPrerequisites: Fix handling of executable scripts
    52445300d6 GetPrerequisites: Allow prefixed tools
    1bac4678ea GetPrerequisites: Add GET_PREREQUISITES_VERBOSE to set verbose
    5072598f07 BundleUtilites: Don't use hardcoded name for install_name_tool
    428680da92 GetPrerequisites: Don't use hardcoded name for otool
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2748


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=08be74bfd7e24af9ffdb64dddffd3d56bf52c3ce
commit 08be74bfd7e24af9ffdb64dddffd3d56bf52c3ce
Author:     Alexander Grund <git at grundis.de>
AuthorDate: Sun Dec 16 18:05:23 2018 +0100
Commit:     Craig Scott <craig.scott at crascit.com>
CommitDate: Sat Jan 5 09:09:39 2019 +1100

    GetPrerequisites: Fix handling of executable scripts
    
    Fixes: #18667

diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index d3b773c..fa6d75a 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -660,6 +660,15 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
     return()
   endif()
 
+  # Check for a script by extension (.bat,.sh,...) or if the file starts with "#!" (shebang)
+  file(READ ${target} file_contents LIMIT 5)
+  if(target MATCHES "\\.(bat|c?sh|bash|ksh|cmd)$" OR file_contents MATCHES "^#!")
+    message(STATUS "GetPrequisites(${target}) : ignoring script file")
+    # Clear var
+    set(${prerequisites_var} "" PARENT_SCOPE)
+    return()
+  endif()
+
   set(gp_cmd_paths ${gp_cmd_paths}
     "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\14.0;InstallDir]/../../VC/bin"
     "$ENV{VS140COMNTOOLS}/../../VC/bin"
diff --git a/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt b/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt
new file mode 100644
index 0000000..5a353d8
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt
@@ -0,0 +1,3 @@
+-- GetPrequisites\(.*script.sh\) : ignoring script file
+-- GetPrequisites\(.*script.bat\) : ignoring script file
+-- GetPrequisites\(.*script\) : ignoring script file
diff --git a/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake b/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake
new file mode 100644
index 0000000..d1bc9b1
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake
@@ -0,0 +1,19 @@
+include(GetPrerequisites)
+
+function(check_script script)
+  set(prereqs "")
+  get_prerequisites(${script} prereqs 1 1 "" "")
+  if(NOT "${prereqs}" STREQUAL "")
+    message(FATAL_ERROR "Prerequisites for ${script} not empty")
+  endif()
+endfunction()
+
+# Should not throw any errors
+# Regular executable
+get_prerequisites(${CMAKE_COMMAND} cmake_prereqs 1 1 "" "")
+# Shell script
+check_script(${CMAKE_CURRENT_LIST_DIR}/script.sh)
+# Batch script
+check_script(${CMAKE_CURRENT_LIST_DIR}/script.bat)
+# Shell script without extension
+check_script(${CMAKE_CURRENT_LIST_DIR}/script)
diff --git a/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake
index 3856c54..a635e38 100644
--- a/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake
@@ -1,3 +1,4 @@
 include(RunCMake)
 
 run_cmake_command(TargetMissing ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TargetMissing.cmake)
+run_cmake_command(ExecutableScripts ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/ExecutableScripts.cmake)
diff --git a/Tests/RunCMake/GetPrerequisites/script b/Tests/RunCMake/GetPrerequisites/script
new file mode 100755
index 0000000..23bf47c
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/script
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+echo "Hello World"
diff --git a/Tests/RunCMake/GetPrerequisites/script.bat b/Tests/RunCMake/GetPrerequisites/script.bat
new file mode 100755
index 0000000..dbb0ec2
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/script.bat
@@ -0,0 +1,3 @@
+ at echo off
+
+echo "Hello world"
diff --git a/Tests/RunCMake/GetPrerequisites/script.sh b/Tests/RunCMake/GetPrerequisites/script.sh
new file mode 100755
index 0000000..23bf47c
--- /dev/null
+++ b/Tests/RunCMake/GetPrerequisites/script.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+echo "Hello World"

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=52445300d67df73b5b8c288cc33c915053c7ba24
commit 52445300d67df73b5b8c288cc33c915053c7ba24
Author:     Alexander Grund <git at grundis.de>
AuthorDate: Sun Dec 16 17:18:41 2018 +0100
Commit:     Craig Scott <craig.scott at crascit.com>
CommitDate: Mon Dec 31 11:56:40 2018 +1100

    GetPrerequisites: Allow prefixed tools
    
    e.g. for cross-compilation with e.g. x86_64-pc-linux-gnu-ldd

diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index fea299c..d3b773c 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -718,25 +718,25 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
 
   set(gp_cmd_maybe_filter)      # optional command to pre-filter gp_tool results
 
-  if(gp_tool STREQUAL "ldd")
+  if(gp_tool MATCHES "ldd$")
     set(gp_cmd_args "")
     set(gp_regex "^[\t ]*[^\t ]+ => ([^\t\(]+) .*${eol_char}$")
     set(gp_regex_error "not found${eol_char}$")
     set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$")
     set(gp_regex_cmp_count 1)
-  elseif(gp_tool STREQUAL "otool")
+  elseif(gp_tool MATCHES "otool$")
     set(gp_cmd_args "-L")
     set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$")
     set(gp_regex_error "")
     set(gp_regex_fallback "")
     set(gp_regex_cmp_count 3)
-  elseif(gp_tool STREQUAL "dumpbin")
+  elseif(gp_tool MATCHES "dumpbin$")
     set(gp_cmd_args "/dependents")
     set(gp_regex "^    ([^ ].*[Dd][Ll][Ll])${eol_char}$")
     set(gp_regex_error "")
     set(gp_regex_fallback "")
     set(gp_regex_cmp_count 1)
-  elseif(gp_tool STREQUAL "objdump")
+  elseif(gp_tool MATCHES "objdump$")
     set(gp_cmd_args "-p")
     set(gp_regex "^\t*DLL Name: (.*\\.[Dd][Ll][Ll])${eol_char}$")
     set(gp_regex_error "")
@@ -759,7 +759,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
   endif()
 
 
-  if(gp_tool STREQUAL "dumpbin")
+  if(gp_tool MATCHES "dumpbin$")
     # When running dumpbin, it also needs the "Common7/IDE" directory in the
     # PATH. It will already be in the PATH if being run from a Visual Studio
     # command prompt. Add it to the PATH here in case we are running from a
@@ -788,7 +788,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
   #
   # </setup-gp_tool-vars>
 
-  if(gp_tool STREQUAL "ldd")
+  if(gp_tool MATCHES "ldd$")
     set(old_ld_env "$ENV{LD_LIBRARY_PATH}")
     set(new_ld_env "${exepath}")
     foreach(dir ${dirs})
@@ -813,7 +813,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
     ERROR_VARIABLE gp_ev
     )
 
-  if(gp_tool STREQUAL "dumpbin")
+  if(gp_tool MATCHES "dumpbin$")
     # Exclude delay load dependencies under windows (they are listed in dumpbin output after the message below)
     string(FIND "${gp_cmd_ov}" "Image has the following delay load dependencies" gp_delayload_pos)
     if (${gp_delayload_pos} GREATER -1)
@@ -827,7 +827,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
   endif()
 
   if(NOT gp_rv STREQUAL "0")
-    if(gp_tool STREQUAL "dumpbin")
+    if(gp_tool MATCHES "dumpbin$")
       # dumpbin error messages seem to go to stdout
       message(FATAL_ERROR "${gp_cmd} failed: ${gp_rv}\n${gp_ev}\n${gp_cmd_ov}")
     else()
@@ -835,7 +835,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
     endif()
   endif()
 
-  if(gp_tool STREQUAL "ldd")
+  if(gp_tool MATCHES "ldd$")
     set(ENV{LD_LIBRARY_PATH} "${old_ld_env}")
   endif()
 
@@ -855,7 +855,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
   # check for install id and remove it from list, since otool -L can include a
   # reference to itself
   set(gp_install_id)
-  if(gp_tool STREQUAL "otool")
+  if(gp_tool MATCHES "otool$")
     execute_process(
       COMMAND ${gp_cmd} -D ${target}
       RESULT_VARIABLE otool_rv

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1bac4678eaf7beefb12ad91ecdea0e551b4d0fcf
commit 1bac4678eaf7beefb12ad91ecdea0e551b4d0fcf
Author:     Alexander Grund <git at grundis.de>
AuthorDate: Sun Dec 16 17:14:23 2018 +0100
Commit:     Craig Scott <craig.scott at crascit.com>
CommitDate: Mon Dec 31 11:56:40 2018 +1100

    GetPrerequisites: Add GET_PREREQUISITES_VERBOSE to set verbose

diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 8d54fed..fea299c 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -63,6 +63,9 @@ searched first when a target without any path info is given.  Then
 standard system locations are also searched: PATH, Framework
 locations, /usr/lib...
 
+The variable GET_PREREQUISITES_VERBOSE can be set to true to enable verbose
+output.
+
 ::
 
   LIST_PREREQUISITES(<target> [<recurse> [<exclude_system> [<verbose>]]])
@@ -644,6 +647,10 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
     set(rpaths "")
   endif()
 
+  if(GET_PREREQUISITES_VERBOSE)
+    set(verbose 1)
+  endif()
+
   if(NOT IS_ABSOLUTE "${target}")
     message("warning: target '${target}' is not absolute...")
   endif()

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5072598f0795f44e157bef8423feda7de24c5504
commit 5072598f0795f44e157bef8423feda7de24c5504
Author:     Alexander Grund <git at grundis.de>
AuthorDate: Sun Dec 30 15:17:35 2018 +0100
Commit:     Craig Scott <craig.scott at crascit.com>
CommitDate: Mon Dec 31 11:56:40 2018 +1100

    BundleUtilites: Don't use hardcoded name for install_name_tool

diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 10e5510..d5c47f8 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -877,9 +877,13 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs)
     execute_process(COMMAND chmod u+w "${resolved_embedded_item}")
   endif()
 
+  # CMAKE_INSTALL_NAME_TOOL may not be set if executed in script mode
+  # Duplicated from CMakeFindBinUtils.cmake
+  find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+
   # Only if install_name_tool supports -delete_rpath:
   #
-  execute_process(COMMAND install_name_tool
+  execute_process(COMMAND ${CMAKE_INSTALL_NAME_TOOL}
     OUTPUT_VARIABLE install_name_tool_usage
     ERROR_VARIABLE  install_name_tool_usage
     )
@@ -897,7 +901,7 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs)
   # to install_name_tool:
   #
   if(changes)
-    set(cmd install_name_tool ${changes} "${resolved_embedded_item}")
+    set(cmd ${CMAKE_INSTALL_NAME_TOOL} ${changes} "${resolved_embedded_item}")
     execute_process(COMMAND ${cmd} RESULT_VARIABLE install_name_tool_result)
     if(NOT install_name_tool_result EQUAL 0)
       string(REPLACE ";" "' '" msg "'${cmd}'")

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=428680da92b98755be1a908ee4a5d705d8753bb9
commit 428680da92b98755be1a908ee4a5d705d8753bb9
Author:     Alexander Grund <git at grundis.de>
AuthorDate: Sun Dec 30 15:08:49 2018 +0100
Commit:     Alexander Grund <git at grundis.de>
CommitDate: Sun Dec 30 15:08:49 2018 +0100

    GetPrerequisites: Don't use hardcoded name for otool

diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 5b32f7c..8d54fed 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -850,7 +850,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
   set(gp_install_id)
   if(gp_tool STREQUAL "otool")
     execute_process(
-      COMMAND otool -D ${target}
+      COMMAND ${gp_cmd} -D ${target}
       RESULT_VARIABLE otool_rv
       OUTPUT_VARIABLE gp_install_id_ov
       ERROR_VARIABLE otool_ev

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

Summary of changes:
 Modules/BundleUtilities.cmake                      |  8 +++--
 Modules/GetPrerequisites.cmake                     | 38 +++++++++++++++-------
 .../GetPrerequisites/ExecutableScripts-stdout.txt  |  3 ++
 .../GetPrerequisites/ExecutableScripts.cmake       | 19 +++++++++++
 Tests/RunCMake/GetPrerequisites/RunCMakeTest.cmake |  1 +
 Tests/RunCMake/GetPrerequisites/script             |  3 ++
 Tests/RunCMake/GetPrerequisites/script.bat         |  3 ++
 Tests/RunCMake/GetPrerequisites/script.sh          |  3 ++
 8 files changed, 65 insertions(+), 13 deletions(-)
 create mode 100644 Tests/RunCMake/GetPrerequisites/ExecutableScripts-stdout.txt
 create mode 100644 Tests/RunCMake/GetPrerequisites/ExecutableScripts.cmake
 create mode 100755 Tests/RunCMake/GetPrerequisites/script
 create mode 100755 Tests/RunCMake/GetPrerequisites/script.bat
 create mode 100755 Tests/RunCMake/GetPrerequisites/script.sh


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list