Explorar o código

Find{BLAS,LAPACK}: Make library variable names more robust

Brad King %!s(int64=4) %!d(string=hai) anos
pai
achega
dcd604ee62
Modificáronse 2 ficheiros con 12 adicións e 10 borrados
  1. 6 5
      Modules/FindBLAS.cmake
  2. 6 5
      Modules/FindLAPACK.cmake

+ 6 - 5
Modules/FindBLAS.cmake

@@ -235,20 +235,21 @@ function(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlib
       # Respect linker flags as-is (required by MKL)
       # Respect linker flags as-is (required by MKL)
       list(APPEND _libraries "${_library}")
       list(APPEND _libraries "${_library}")
     else()
     else()
-      set(_combined_name ${_combined_name}_${_library})
+      string(REGEX REPLACE "[^A-Za-z0-9]" "_" _lib_var "${_library}")
+      set(_combined_name ${_combined_name}_${_lib_var})
       if(NOT "${_deps}" STREQUAL "")
       if(NOT "${_deps}" STREQUAL "")
         set(_combined_name ${_combined_name}_deps)
         set(_combined_name ${_combined_name}_deps)
       endif()
       endif()
       if(_libraries_work)
       if(_libraries_work)
-        find_library(${_prefix}_${_library}_LIBRARY
+        find_library(${_prefix}_${_lib_var}_LIBRARY
           NAMES ${_library}
           NAMES ${_library}
           NAMES_PER_DIR
           NAMES_PER_DIR
           PATHS ${_extaddlibdir}
           PATHS ${_extaddlibdir}
           PATH_SUFFIXES ${_subdirs}
           PATH_SUFFIXES ${_subdirs}
         )
         )
-        mark_as_advanced(${_prefix}_${_library}_LIBRARY)
-        list(APPEND _libraries ${${_prefix}_${_library}_LIBRARY})
-        set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
+        mark_as_advanced(${_prefix}_${_lib_var}_LIBRARY)
+        list(APPEND _libraries ${${_prefix}_${_lib_var}_LIBRARY})
+        set(_libraries_work ${${_prefix}_${_lib_var}_LIBRARY})
       endif()
       endif()
     endif()
     endif()
   endforeach()
   endforeach()

+ 6 - 5
Modules/FindLAPACK.cmake

@@ -217,20 +217,21 @@ function(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addl
       # Respect linker flags as-is (required by MKL)
       # Respect linker flags as-is (required by MKL)
       list(APPEND _libraries "${_library}")
       list(APPEND _libraries "${_library}")
     else()
     else()
-      set(_combined_name ${_combined_name}_${_library})
+      string(REGEX REPLACE "[^A-Za-z0-9]" "_" _lib_var "${_library}")
+      set(_combined_name ${_combined_name}_${_lib_var})
       if(NOT "${_deps}" STREQUAL "")
       if(NOT "${_deps}" STREQUAL "")
         set(_combined_name ${_combined_name}_deps)
         set(_combined_name ${_combined_name}_deps)
       endif()
       endif()
       if(_libraries_work)
       if(_libraries_work)
-        find_library(${_prefix}_${_library}_LIBRARY
+        find_library(${_prefix}_${_lib_var}_LIBRARY
           NAMES ${_library}
           NAMES ${_library}
           NAMES_PER_DIR
           NAMES_PER_DIR
           PATHS ${_extaddlibdir}
           PATHS ${_extaddlibdir}
           PATH_SUFFIXES ${_subdirs}
           PATH_SUFFIXES ${_subdirs}
         )
         )
-        mark_as_advanced(${_prefix}_${_library}_LIBRARY)
-        list(APPEND _libraries ${${_prefix}_${_library}_LIBRARY})
-        set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
+        mark_as_advanced(${_prefix}_${_lib_var}_LIBRARY)
+        list(APPEND _libraries ${${_prefix}_${_lib_var}_LIBRARY})
+        set(_libraries_work ${${_prefix}_${_lib_var}_LIBRARY})
       endif()
       endif()
     endif()
     endif()
   endforeach()
   endforeach()