diff options
author | Brad King <brad.king@kitware.com> | 2011-06-07 18:06:09 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2011-06-07 18:06:09 (GMT) |
commit | 40792a1a15f1ee3c0582486aac9182f8eaa1b316 (patch) | |
tree | 6f8dd3136a768559da114b04c00b40bc81ef6d72 /Modules | |
parent | 43d3048582e34a84cc061fddeb3e7967a2c7a576 (diff) | |
parent | 51e16c05f7c4e70d8bbf97a13243b1f1cfffa2d7 (diff) | |
download | CMake-40792a1a15f1ee3c0582486aac9182f8eaa1b316.zip CMake-40792a1a15f1ee3c0582486aac9182f8eaa1b316.tar.gz CMake-40792a1a15f1ee3c0582486aac9182f8eaa1b316.tar.bz2 |
Merge topic 'fix-12034-fixup-bundle-with-non-dotapp-exe'
51e16c0 BundleUtilities: Avoid test on Watcom dashboards (#12034)
41f962a Revert "BundleUtilities: Run test on Windows if either MSVC or dumpbin was found."
e17135e BundleUtilities: Add rpath to loadable modules in test.
8064044 BundleUtilities: Print reason for not loading module.so
f3de459 BundleUtilities: Run test on Windows if either MSVC or dumpbin was found.
900bf98 BundleUtilities: Disable running test on Windows unless using MSVC.
fa4dc08 BundleUtilities: Fix issues with custom target DEPENDS in test (#12034)
e40b79e BundleUtilities: Fix test when using xcode (#12034)
b68d3dc BundleUtilities: Fix regex to extract dependents from ldd (#12034)
7ac7b43 BundleUtilities: Work w/ non .app exes on Mac (#12034)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/BundleUtilities.cmake | 51 | ||||
-rw-r--r-- | Modules/GetPrerequisites.cmake | 6 |
2 files changed, 28 insertions, 29 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 5e4bf46..0143d59 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -53,9 +53,8 @@ # # GET_DOTAPP_DIR(<exe> <dotapp_dir_var>) # Returns the nearest parent dir whose name ends with ".app" given the full -# path to an executable. If there is no such parent dir, then return a dir at -# the same level as the executable, named with the executable's base name and -# ending with ".app" +# path to an executable. If there is no such parent dir, then simply return +# the dir containing the executable. # # The returned directory may or may not exist. # @@ -227,35 +226,35 @@ endfunction(get_bundle_main_executable) function(get_dotapp_dir exe dotapp_dir_var) set(s "${exe}") - set(has_dotapp_parent 0) if(s MATCHES "^.*/.*\\.app/.*$") - set(has_dotapp_parent 1) - endif(s MATCHES "^.*/.*\\.app/.*$") - - set(done 0) - while(NOT ${done}) - get_filename_component(snamewe "${s}" NAME_WE) - get_filename_component(sname "${s}" NAME) - get_filename_component(sdir "${s}" PATH) - if(has_dotapp_parent) - # If there is a ".app" parent directory, - # ascend until we hit it: - # (typical of a Mac bundle executable) - # + # If there is a ".app" parent directory, + # ascend until we hit it: + # (typical of a Mac bundle executable) + # + set(done 0) + while(NOT ${done}) + get_filename_component(snamewe "${s}" NAME_WE) + get_filename_component(sname "${s}" NAME) + get_filename_component(sdir "${s}" PATH) set(s "${sdir}") if(sname MATCHES "\\.app$") set(done 1) set(dotapp_dir "${sdir}/${sname}") endif(sname MATCHES "\\.app$") - else(has_dotapp_parent) - # Otherwise use a directory named the same - # as the exe, but with a ".app" extension: - # (typical of a non-bundle executable on Mac, Windows or Linux) - # - set(done 1) - set(dotapp_dir "${sdir}/${snamewe}.app") - endif(has_dotapp_parent) - endwhile(NOT ${done}) + endwhile(NOT ${done}) + else(s MATCHES "^.*/.*\\.app/.*$") + # Otherwise use a directory containing the exe + # (typical of a non-bundle executable on Mac, Windows or Linux) + # + is_file_executable("${s}" is_executable) + if(is_executable) + get_filename_component(sdir "${s}" PATH) + set(dotapp_dir "${sdir}") + else(is_executable) + set(dotapp_dir "${s}") + endif(is_executable) + endif(s MATCHES "^.*/.*\\.app/.*$") + set(${dotapp_dir_var} "${dotapp_dir}" PARENT_SCOPE) endfunction(get_dotapp_dir) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 853b1a1..023b8b5 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -261,9 +261,9 @@ function(gp_resolve_item context item exepath dirs resolved_item_var) # Is it already resolved? # - if(EXISTS "${resolved_item}") + if(IS_ABSOLUTE "${resolved_item}" AND EXISTS "${resolved_item}") set(resolved 1) - endif(EXISTS "${resolved_item}") + endif(IS_ABSOLUTE "${resolved_item}" AND EXISTS "${resolved_item}") if(NOT resolved) if(item MATCHES "@executable_path") @@ -548,7 +548,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if("${gp_tool}" STREQUAL "ldd") set(gp_cmd_args "") - set(gp_regex "^[\t ]*[^\t ]+ => ([^\t ]+).*${eol_char}$") + 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) |