[Cmake-commits] CMake branch, next, updated. v3.7.2-2510-g9a4338d

Brad King brad.king at kitware.com
Thu Feb 2 10:33:47 EST 2017


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  9a4338d7f59750c2cbd61ed0a252224f102f0384 (commit)
       via  44fb57c9093b67bc533380b12727997f8e67efa1 (commit)
       via  071c3622c8954ed74e27ce7671d5de83627dfd0b (commit)
       via  8211f08186e67fb88296ff055d95048296482307 (commit)
       via  74643ffb144fc5045107fdfc2f4ebdc8e4854a37 (commit)
      from  903c0cda337e58c95ff947fdd4b0b21396bd6feb (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=9a4338d7f59750c2cbd61ed0a252224f102f0384
commit 9a4338d7f59750c2cbd61ed0a252224f102f0384
Merge: 903c0cd 44fb57c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Feb 2 10:33:36 2017 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Feb 2 10:33:36 2017 -0500

    Merge topic 'FindHDF5-fix-HDF5_ROOT' into next
    
    44fb57c9 FindHDF5: Fix search with HDF5_ROOT
    071c3622 FindHDF5: Use keywords in find_library calls
    8211f081 FindHDF5: Initialize/finalize internal search options variable
    74643ffb FindHDF5: Fix command-line parsing argument extraction order


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=44fb57c9093b67bc533380b12727997f8e67efa1
commit 44fb57c9093b67bc533380b12727997f8e67efa1
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Feb 2 09:21:21 2017 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Feb 2 10:23:19 2017 -0500

    FindHDF5: Fix search with HDF5_ROOT
    
    Refactoring in commit v3.6.0-rc1~72^2 (HDF5: Rework component searching
    to correctly find HL for all bindings, 2016-05-12) turned off a large
    amount of its logic when HDF5_ROOT is set.  This caused use of the hdf5
    compiler wrapper to extract all needed libraries (e.g. z, dl as
    dependencies of hdf5 static libraries) to be skipped when using
    HDF5_ROOT.
    
    Fix the search logic to honor HDF5_ROOT in all code paths.  Restrict the
    search for hdf5-specific components to this root, but allow external
    libraries to be found anywhere.
    
    Fixes: #16566

diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 84a83ba..4f79a32 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -383,10 +383,18 @@ endmacro()
 if(NOT HDF5_ROOT)
     set(HDF5_ROOT $ENV{HDF5_ROOT})
 endif()
+if(HDF5_ROOT)
+    set(_HDF5_SEARCH_OPTS NO_DEFAULT_PATH)
+else()
+    set(_HDF5_SEARCH_OPTS)
+endif()
 
 # Try to find HDF5 using an installed hdf5-config.cmake
-if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
-    find_package(HDF5 QUIET NO_MODULE)
+if(NOT HDF5_FOUND)
+    find_package(HDF5 QUIET NO_MODULE
+      HINTS ${HDF5_ROOT}
+      ${_HDF5_SEARCH_OPTS}
+      )
     if( HDF5_FOUND)
         set(HDF5_IS_PARALLEL ${HDF5_ENABLE_PARALLEL})
         set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
@@ -440,7 +448,7 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
     endif()
 endif()
 
-if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
+if(NOT HDF5_FOUND)
   set(_HDF5_NEED_TO_SEARCH False)
   set(HDF5_COMPILER_NO_INTERROGATE True)
   # Only search for languages we've enabled
@@ -488,8 +496,10 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
       # search options with the wrapper
       find_program(HDF5_${__lang}_COMPILER_EXECUTABLE
         NAMES ${HDF5_${__lang}_COMPILER_NAMES} NAMES_PER_DIR
+        HINTS ${HDF5_ROOT}
         PATH_SUFFIXES bin Bin
         DOC "HDF5 ${__lang} Wrapper compiler.  Used only to detect HDF5 compile flags."
+        ${_HDF5_SEARCH_OPTS}
       )
       mark_as_advanced( HDF5_${__lang}_COMPILER_EXECUTABLE )
       unset(HDF5_${__lang}_COMPILER_NAMES)
@@ -516,10 +526,20 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
           endif()
 
           foreach(L IN LISTS HDF5_${__lang}_LIBRARY_NAMES)
+            if(x"${L}" MATCHES "hdf5")
+              # hdf5 library
+              set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS})
+            else()
+              # external library
+              set(_HDF5_SEARCH_OPTS_LOCAL)
+            endif()
             find_library(HDF5_${__lang}_LIBRARY_${L}
               NAMES ${L}
               HINTS ${HDF5_${__lang}_LIBRARY_DIRS}
+                    ${HDF5_ROOT}
+              ${_HDF5_SEARCH_OPTS_LOCAL}
               )
+            unset(_HDF5_SEARCH_OPTS_LOCAL)
             if(HDF5_${__lang}_LIBRARY_${L})
               list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}})
             else()
@@ -529,10 +549,20 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
           if(FIND_HL)
             set(HDF5_${__lang}_HL_LIBRARIES)
             foreach(L IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES)
+              if("x${L}" MATCHES "hdf5")
+                # hdf5 library
+                set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS})
+              else()
+                # external library
+                set(_HDF5_SEARCH_OPTS_LOCAL)
+              endif()
               find_library(HDF5_${__lang}_LIBRARY_${L}
                 NAMES ${L}
                 HINTS ${HDF5_${__lang}_LIBRARY_DIRS}
+                      ${HDF5_ROOT}
+                ${_HDF5_SEARCH_OPTS_LOCAL}
                 )
+              unset(_HDF5_SEARCH_OPTS_LOCAL)
               if(HDF5_${__lang}_LIBRARY_${L})
                 list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}})
               else()
@@ -614,11 +644,6 @@ elseif(NOT HDF5_FOUND AND NOT _HDF5_NEED_TO_SEARCH)
   endif()
 endif()
 
-if(HDF5_ROOT)
-    set(_HDF5_SEARCH_OPTS NO_DEFAULT_PATH)
-else()
-    set(_HDF5_SEARCH_OPTS)
-endif()
 find_program( HDF5_DIFF_EXECUTABLE
     NAMES h5diff
     HINTS ${HDF5_ROOT}

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=071c3622c8954ed74e27ce7671d5de83627dfd0b
commit 071c3622c8954ed74e27ce7671d5de83627dfd0b
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Feb 2 09:16:47 2017 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Feb 2 10:11:12 2017 -0500

    FindHDF5: Use keywords in find_library calls
    
    Clarify the purpose of each argument.

diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index e982a42..84a83ba 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -516,7 +516,10 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
           endif()
 
           foreach(L IN LISTS HDF5_${__lang}_LIBRARY_NAMES)
-            find_library(HDF5_${__lang}_LIBRARY_${L} ${L} ${HDF5_${__lang}_LIBRARY_DIRS})
+            find_library(HDF5_${__lang}_LIBRARY_${L}
+              NAMES ${L}
+              HINTS ${HDF5_${__lang}_LIBRARY_DIRS}
+              )
             if(HDF5_${__lang}_LIBRARY_${L})
               list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}})
             else()
@@ -526,7 +529,10 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
           if(FIND_HL)
             set(HDF5_${__lang}_HL_LIBRARIES)
             foreach(L IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES)
-              find_library(HDF5_${__lang}_LIBRARY_${L} ${L} ${HDF5_${__lang}_LIBRARY_DIRS})
+              find_library(HDF5_${__lang}_LIBRARY_${L}
+                NAMES ${L}
+                HINTS ${HDF5_${__lang}_LIBRARY_DIRS}
+                )
               if(HDF5_${__lang}_LIBRARY_${L})
                 list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}})
               else()

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8211f08186e67fb88296ff055d95048296482307
commit 8211f08186e67fb88296ff055d95048296482307
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Feb 2 09:13:46 2017 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Feb 2 10:10:28 2017 -0500

    FindHDF5: Initialize/finalize internal search options variable
    
    While at it, use a more private name.

diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 648b081..e982a42 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -609,13 +609,15 @@ elseif(NOT HDF5_FOUND AND NOT _HDF5_NEED_TO_SEARCH)
 endif()
 
 if(HDF5_ROOT)
-    set(SEARCH_OPTS NO_DEFAULT_PATH)
+    set(_HDF5_SEARCH_OPTS NO_DEFAULT_PATH)
+else()
+    set(_HDF5_SEARCH_OPTS)
 endif()
 find_program( HDF5_DIFF_EXECUTABLE
     NAMES h5diff
     HINTS ${HDF5_ROOT}
     PATH_SUFFIXES bin Bin
-    ${SEARCH_OPTS}
+    ${_HDF5_SEARCH_OPTS}
     DOC "HDF5 file differencing tool." )
 mark_as_advanced( HDF5_DIFF_EXECUTABLE )
 
@@ -644,7 +646,7 @@ if( NOT HDF5_FOUND )
             HINTS ${HDF5_ROOT}
             PATHS $ENV{HOME}/.local/include
             PATH_SUFFIXES include Include
-            ${SEARCH_OPTS}
+            ${_HDF5_SEARCH_OPTS}
         )
         mark_as_advanced(HDF5_${LANGUAGE}_INCLUDE_DIR)
         list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR})
@@ -668,12 +670,12 @@ if( NOT HDF5_FOUND )
             find_library(HDF5_${LIB}_LIBRARY_DEBUG
                 NAMES ${THIS_LIBRARY_SEARCH_DEBUG}
                 HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
-                ${SEARCH_OPTS}
+                ${_HDF5_SEARCH_OPTS}
             )
             find_library( HDF5_${LIB}_LIBRARY_RELEASE
                 NAMES ${THIS_LIBRARY_SEARCH_RELEASE}
                 HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
-                ${SEARCH_OPTS}
+                ${_HDF5_SEARCH_OPTS}
             )
             select_library_configurations( HDF5_${LIB} )
             list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${LIB}_LIBRARY})
@@ -705,12 +707,12 @@ if( NOT HDF5_FOUND )
                 find_library(HDF5_${LIB}_LIBRARY_DEBUG
                     NAMES ${THIS_LIBRARY_SEARCH_DEBUG}
                     HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
-                    ${SEARCH_OPTS}
+                    ${_HDF5_SEARCH_OPTS}
                 )
                 find_library( HDF5_${LIB}_LIBRARY_RELEASE
                     NAMES ${THIS_LIBRARY_SEARCH_RELEASE}
                     HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
-                    ${SEARCH_OPTS}
+                    ${_HDF5_SEARCH_OPTS}
                 )
                 select_library_configurations( HDF5_${LIB} )
                 list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${LIB}_LIBRARY})
@@ -785,3 +787,5 @@ find_package_handle_standard_args(HDF5
     VERSION_VAR   HDF5_VERSION
     HANDLE_COMPONENTS
 )
+
+unset(_HDF5_SEARCH_OPTS)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=74643ffb144fc5045107fdfc2f4ebdc8e4854a37
commit 74643ffb144fc5045107fdfc2f4ebdc8e4854a37
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Feb 2 10:05:51 2017 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Feb 2 10:09:49 2017 -0500

    FindHDF5: Fix command-line parsing argument extraction order
    
    Re-implement our internal `_HDF5_parse_compile_line` helper to process
    command line arguments all at once and in order.  Otherwise the
    libraries named by absolute path and those named by `-l` arguments are
    not kept in order.
    
    The new implementation will not handle separate arguments like
    `-I /path/to/include/dir` but I have not seen the HDF5 compiler
    wrappers produce this form.  If necessary the parsing loop can
    be extended with a state variable to keep track of such pairs.

diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 6e5a25e..648b081 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -340,62 +340,44 @@ macro( _HDF5_parse_compile_line
     libraries
     libraries_hl)
 
-    # Match the include paths
-    set( RE " -I *([^\" ]+|\"[^\"]+\")")
-    string( REGEX MATCHALL "${RE}" include_path_flags "${${compile_line_var}}")
-    foreach( IPATH IN LISTS include_path_flags )
-        string( REGEX REPLACE "${RE}" "\\1" IPATH "${IPATH}" )
-        list( APPEND ${include_paths} ${IPATH} )
-    endforeach()
-
-    # Match the definitions
-    set( RE " -D([^ ]*)")
-    string( REGEX MATCHALL "${RE}" definition_flags "${${compile_line_var}}" )
-    foreach( DEF IN LISTS definition_flags )
-        string( STRIP "${DEF}" DEF )
-        list( APPEND ${definitions} ${DEF} )
-    endforeach()
-
-    # Match the library paths
-    set( RE " -L *([^\" ]+|\"[^\"]+\")")
-    string( REGEX MATCHALL "${RE}" library_path_flags "${${compile_line_var}}")
-    foreach( LPATH IN LISTS library_path_flags )
-        string( REGEX REPLACE "${RE}" "\\1" LPATH "${LPATH}" )
-        list( APPEND ${library_paths} ${LPATH} )
-    endforeach()
-
-    # now search for the lib names specified in the compile line (match -l...)
-    # match only -l's preceded by a space or comma
-    set( RE " -l *([^\" ]+|\"[^\"]+\")")
-    string( REGEX MATCHALL "${RE}" library_name_flags "${${compile_line_var}}")
-    foreach( LNAME IN LISTS library_name_flags )
-        string( REGEX REPLACE "${RE}" "\\1" LNAME "${LNAME}" )
-        if(LNAME MATCHES ".*hl")
-            list(APPEND ${libraries_hl} ${LNAME})
-        else()
-            list(APPEND ${libraries} ${LNAME})
-        endif()
-    endforeach()
+  if(UNIX)
+    separate_arguments(_HDF5_COMPILE_ARGS UNIX_COMMAND "${${compile_line_var}}")
+  else()
+    separate_arguments(_HDF5_COMPILE_ARGS WINDOWS_COMMAND "${${compile_line_var}}")
+  endif()
 
-    # now search for full library paths with no flags
-    set( RE " ([^\" ]+|\"[^\"]+\")")
-    string( REGEX MATCHALL "${RE}" library_name_noflags "${${compile_line_var}}")
-    foreach( LIB IN LISTS library_name_noflags )
-        string( REGEX REPLACE "${RE}" "\\1" LIB "${LIB}" )
-        get_filename_component(LIB "${LIB}" ABSOLUTE)
-        if(NOT EXISTS ${LIB} OR IS_DIRECTORY ${LIB})
-            continue()
-        endif()
-        get_filename_component(LPATH ${LIB} DIRECTORY)
-        get_filename_component(LNAME ${LIB} NAME_WE)
-        string( REGEX REPLACE "^lib" "" LNAME ${LNAME} )
-        list( APPEND ${library_paths} ${LPATH} )
-        if(LNAME MATCHES ".*hl")
-            list(APPEND ${libraries_hl} ${LNAME})
-        else()
-            list(APPEND ${libraries} ${LNAME})
-        endif()
-    endforeach()
+  foreach(arg IN LISTS _HDF5_COMPILE_ARGS)
+    if("${arg}" MATCHES "^-I(.*)$")
+      # include directory
+      list(APPEND ${include_paths} "${CMAKE_MATCH_1}")
+    elseif("${arg}" MATCHES "^-D(.*)$")
+      # compile definition
+      list(APPEND ${definitions} "${CMAKE_MATCH_1}")
+    elseif("${arg}" MATCHES "^-L(.*)$")
+      # library search path
+      list(APPEND ${library_paths} "${CMAKE_MATCH_1}")
+    elseif("${arg}" MATCHES "^-l(.*)hl$")
+      # library name (hl)
+      list(APPEND ${libraries_hl} "${CMAKE_MATCH_1}")
+    elseif("${arg}" MATCHES "^-l(.*)$")
+      # library name
+      list(APPEND ${libraries} "${CMAKE_MATCH_1}")
+    elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.(a|so|dylib|sl|lib)$")
+      # library file
+      if(NOT EXISTS "${arg}")
+        continue()
+      endif()
+      get_filename_component(_HDF5_LPATH "${arg}" DIRECTORY)
+      get_filename_component(_HDF5_LNAME "${arg}" NAME_WE)
+      string(REGEX REPLACE "^lib" "" _HDF5_LNAME "${_HDF5_LNAME}")
+      list(APPEND ${library_paths} "${_HDF5_LPATH}")
+      if(_HDF5_LNAME MATCHES ".*hl")
+        list(APPEND ${libraries_hl} "${_HDF5_LNAME}")
+      else()
+        list(APPEND ${libraries} "${_HDF5_LNAME}")
+      endif()
+    endif()
+  endforeach()
 endmacro()
 
 if(NOT HDF5_ROOT)

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

Summary of changes:
 Modules/FindHDF5.cmake |  155 +++++++++++++++++++++++++++---------------------
 1 file changed, 86 insertions(+), 69 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list