FindBLAS.cmake
Go to the documentation of this file.
1 ##############################################################################
2 # @file FindBLAS.cmake
3 # @brief Find BLAS library.
4 #
5 # This module finds an installed fortran library that implements the BLAS
6 # linear-algebra interface (see http://www.netlib.org/blas/).
7 # The list of libraries searched for is taken
8 # from the autoconf macro file, acx_blas.m4 (distributed at
9 # http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
10 #
11 # Modified by Andreas Schuh to enable the use at SBIA, where an ATLAS C library
12 # is installed which contains the symbols without trailing _ character, i.e.,
13 # instead of checking the existence of the cblas_dgemm_ function, the
14 # existence of the cblas_dgemm function has to be checked. Moreover, added
15 # code to mark variable as advanced and only show them to the user if
16 # no required library was found. If the found library is cblas, the corresponding
17 # header file cblas.h is searched as well. Therefore, added the BLAS_INCLUDE_DIR
18 # variable which is only defined if required.
19 #
20 # This module sets the following variables:
21 # BLAS_FOUND - set to true if a library implementing the BLAS interface
22 # is found
23 # BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l
24 # and -L).
25 # BLAS_LIBRARIES - uncached list of libraries (using full path name) to
26 # link against to use BLAS
27 # BLAS_INCLUDE_DIR - uncached list of include directories for C libraries
28 # BLAS95_LIBRARIES - uncached list of libraries (using full path name)
29 # to link against to use BLAS95 interface
30 # BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
31 # is found
32 # BLA_STATIC if set on this determines what kind of linkage we do (static)
33 # BLA_VENDOR if set checks only the specified vendor, if not set checks
34 # all the possibilities
35 # BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
36 #
37 # List of vendors (BLA_VENDOR) valid in this module
38 # ATLAS, PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model),
39 # Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,Apple, NAS, Generic
40 # C/CXX should be enabled to use Intel mkl
41 #
42 # @ingroup CMakeFindModules
43 ##############################################################################
44 
45 # ============================================================================
46 # Copyright 2007-2009 Kitware, Inc.
47 # All rights reserved.
48 #
49 # Distributed under the OSI-approved BSD License (the "License");
50 # see accompanying file Copyright.txt for details.
51 #
52 # This software is distributed WITHOUT ANY WARRANTY; without even the
53 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
54 # See the License for more information.
55 #=============================================================================
56 # (To distribute this file outside of CMake, substitute the full
57 # License text for the above reference.)
58 
59 set(BLAS_LIBRARIES_VARS) # set by check_fortran_libraries() to a list of
60  # variable names of each searched library such
61  # that these libraries can be made non-advanced
62  # in case no library was found
63 
64 include(CheckFunctionExists)
65 include(CheckFortranFunctionExists)
66 
67 # Check the language being used
68 get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES )
69 if( _LANGUAGES_ MATCHES Fortran )
70  set( _CHECK_FORTRAN TRUE )
71 elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) )
72  set( _CHECK_FORTRAN FALSE )
73 else()
74  if(BLAS_FIND_REQUIRED)
75  message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.")
76  else(BLAS_FIND_REQUIRED)
77  message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)")
78  return()
79  endif(BLAS_FIND_REQUIRED)
80 endif( )
81 
82 macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads)
83 # This macro checks for the existence of the combination of fortran libraries
84 # given by _list. If the combination is found, this macro checks (using the
85 # Check_Fortran_Function_Exists macro) whether can link against that library
86 # combination using the name of a routine given by _name using the linker
87 # flags given by _flags. If the combination of libraries is found and passes
88 # the link test, LIBRARIES is set to the list of complete library paths that
89 # have been found. Otherwise, LIBRARIES is set to FALSE.
90 
91 # N.B. _prefix is the prefix applied to the names of all cached variables that
92 # are generated internally and marked advanced by this macro.
93 
94 set(_libraries_work TRUE)
95 set(${LIBRARIES})
96 set(_combined_name)
97 foreach(_library ${_list})
98  set(_combined_name ${_combined_name}_${_library})
99 
100  if(_libraries_work)
101  if ( WIN32 )
102  if(BLA_STATIC)
103  set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
104  endif(BLA_STATIC)
105  find_library(${_prefix}_${_library}_LIBRARY
106  NAMES ${_library}
107  PATHS ENV LIB
108  )
109  endif ( WIN32 )
110 
111  if ( APPLE )
112  if(BLA_STATIC)
113  set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.dylib")
114  endif(BLA_STATIC)
115  find_library(${_prefix}_${_library}_LIBRARY
116  NAMES ${_library}
117  PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
118  )
119 
120  else ( APPLE )
121  if(BLA_STATIC)
122  set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
123  endif(BLA_STATIC)
124  find_library(${_prefix}_${_library}_LIBRARY
125  NAMES ${_library}
126  PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
127  )
128  endif( APPLE )
129  mark_as_advanced(${_prefix}_${_library}_LIBRARY)
130  list (APPEND BLAS_LIBRARIES_VARS ${_prefix}_${_library}_LIBRARY)
131  set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
132  set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
133  endif(_libraries_work)
134 endforeach(_library ${_list})
135 if(_libraries_work)
136  # Test this combination of libraries.
137  set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads})
138 # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
139  if (_CHECK_FORTRAN)
140  check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
141  else()
142  check_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
143  if (NOT ${_prefix}${_combined_name}_WORKS)
144  check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
145  endif ()
146  endif()
147  set(CMAKE_REQUIRED_LIBRARIES)
148  mark_as_advanced(${_prefix}${_combined_name}_WORKS)
149  set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
150 endif(_libraries_work)
151 if(NOT _libraries_work)
152  set(${LIBRARIES} FALSE)
153 endif(NOT _libraries_work)
154 #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
155 endmacro(Check_Fortran_Libraries)
156 
158 set(BLAS_LIBRARIES)
159 set(BLAS95_LIBRARIES)
160 if ($ENV{BLA_VENDOR} MATCHES ".+")
162 else ($ENV{BLA_VENDOR} MATCHES ".+")
163  if(NOT BLA_VENDOR)
164  set(BLA_VENDOR "All")
165  endif(NOT BLA_VENDOR)
166 endif ($ENV{BLA_VENDOR} MATCHES ".+")
167 
168 if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
169  if(NOT BLAS_LIBRARIES)
170  # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
171  check_fortran_libraries(
172  BLAS_LIBRARIES
173  BLAS
174  cblas_dgemm
175  ""
176  "cblas;f77blas;atlas"
177  ""
178  )
179  if (BLAS_LIBRARIES_VARS MATCHES "cblas")
180  find_path (BLAS_INCLUDE_DIR NAMES cblas.h DOC "Include directory of the cblas.h header file.")
181  endif ()
182  endif(NOT BLAS_LIBRARIES)
183 endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
184 
185 # BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
186 if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
187  if(NOT BLAS_LIBRARIES)
188  check_fortran_libraries(
189  BLAS_LIBRARIES
190  BLAS
191  sgemm
192  ""
193  "sgemm;dgemm;blas"
194  ""
195  )
196  endif(NOT BLAS_LIBRARIES)
197 endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
198 
199 # BLAS in Alpha CXML library?
200 if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
201  if(NOT BLAS_LIBRARIES)
202  check_fortran_libraries(
203  BLAS_LIBRARIES
204  BLAS
205  sgemm
206  ""
207  "cxml"
208  ""
209  )
210  endif(NOT BLAS_LIBRARIES)
211 endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
212 
213 # BLAS in Alpha DXML library? (now called CXML, see above)
214 if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
215  if(NOT BLAS_LIBRARIES)
216  check_fortran_libraries(
217  BLAS_LIBRARIES
218  BLAS
219  sgemm
220  ""
221  "dxml"
222  ""
223  )
224  endif(NOT BLAS_LIBRARIES)
225 endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
226 
227 # BLAS in Sun Performance library?
228 if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
229  if(NOT BLAS_LIBRARIES)
230  check_fortran_libraries(
231  BLAS_LIBRARIES
232  BLAS
233  sgemm
234  "-xlic_lib=sunperf"
235  "sunperf;sunmath"
236  ""
237  )
238  if(BLAS_LIBRARIES)
239  set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
240  endif(BLAS_LIBRARIES)
241  endif(NOT BLAS_LIBRARIES)
242 endif (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
243 
244 # BLAS in SCSL library? (SGI/Cray Scientific Library)
245 if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
246  if(NOT BLAS_LIBRARIES)
247  check_fortran_libraries(
248  BLAS_LIBRARIES
249  BLAS
250  sgemm
251  ""
252  "scsl"
253  ""
254  )
255  endif(NOT BLAS_LIBRARIES)
256 endif (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
257 
258 # BLAS in SGIMATH library?
259 if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
260  if(NOT BLAS_LIBRARIES)
261  check_fortran_libraries(
262  BLAS_LIBRARIES
263  BLAS
264  sgemm
265  ""
266  "complib.sgimath"
267  ""
268  )
269  endif(NOT BLAS_LIBRARIES)
270 endif (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
271 
272 # BLAS in IBM ESSL library? (requires generic BLAS lib, too)
273 if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
274  if(NOT BLAS_LIBRARIES)
275  check_fortran_libraries(
276  BLAS_LIBRARIES
277  BLAS
278  sgemm
279  ""
280  "essl;blas"
281  ""
282  )
283  endif(NOT BLAS_LIBRARIES)
284 endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
285 
286 #BLAS in acml library?
287 if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "ACML_MP" OR BLA_VENDOR STREQUAL "All")
288 # the patch from Chuck Atkins:
289  if( ((_BLAS_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR
290  ((_BLAS_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) )
291  if( WIN32 )
292  file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" )
293  else()
294  file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" )
295  endif()
296  if( _ACML_ROOT )
297  get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )
298  if( SIZEOF_INTEGER EQUAL 8 )
299  set( _ACML_PATH_SUFFIX "_int64" )
300  else()
301  set( _ACML_PATH_SUFFIX "" )
302  endif()
303  if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
304  set( _ACML_COMPILER32 "ifort32" )
305  set( _ACML_COMPILER64 "ifort64" )
306  elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )
307  set( _ACML_COMPILER32 "sun32" )
308  set( _ACML_COMPILER64 "sun64" )
309  elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
310  set( _ACML_COMPILER32 "pgi32" )
311  if( WIN32 )
312  set( _ACML_COMPILER64 "win64" )
313  else()
314  set( _ACML_COMPILER64 "pgi64" )
315  endif()
316  elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" )
317  # 32 bit builds not supported on Open64 but for code simplicity
318  # We'll just use the same directory twice
319  set( _ACML_COMPILER32 "open64_64" )
320  set( _ACML_COMPILER64 "open64_64" )
321  elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )
322  set( _ACML_COMPILER32 "nag32" )
323  set( _ACML_COMPILER64 "nag64" )
324  else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
325  set( _ACML_COMPILER32 "gfortran32" )
326  set( _ACML_COMPILER64 "gfortran64" )
327  endif()
328 
329  if( _BLAS_VENDOR STREQUAL "ACML_MP" )
330  set(_ACML_MP_LIB_DIRS
331  "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
332  "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
333  else() #if( _BLAS_VENDOR STREQUAL "ACML" )
334  set(_ACML_LIB_DIRS
335  "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
336  "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
337  endif()
338  endif()
339  endif()
340 
341  if( _BLAS_VENDOR STREQUAL "ACML_MP" )
342  foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS} )
343  _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml_mp;acml_mv" "" )
344  if( BLAS_${_BLAS_VENDOR}_FOUND )
345  break()
346  endif()
347  endforeach()
348  else() #if( _BLAS_VENDOR STREQUAL "ACML" )
349  foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} )
350  _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml;acml_mv" "" )
351  if( BLAS_${_BLAS_VENDOR}_FOUND )
352  break()
353  endif()
354  endforeach()
355  endif()
356 
357  # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both
358  if(NOT BLAS_LIBRARIES)
359  check_fortran_libraries(
360  BLAS_LIBRARIES
361  BLAS
362  sgemm
363  ""
364  "acml;acml_mv"
365  ""
366  )
367  endif(NOT BLAS_LIBRARIES)
368  if(NOT BLAS_LIBRARIES)
369  check_fortran_libraries(
370  BLAS_LIBRARIES
371  BLAS
372  sgemm
373  ""
374  "acml_mp;acml_mv"
375  ""
376  )
377  endif(NOT BLAS_LIBRARIES)
378 endif () # ACML
379 
380 # Apple BLAS library?
381 if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
382 if(NOT BLAS_LIBRARIES)
383  check_fortran_libraries(
384  BLAS_LIBRARIES
385  BLAS
386  cblas_dgemm
387  ""
388  "Accelerate"
389  ""
390  )
391  endif(NOT BLAS_LIBRARIES)
392 endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
393 
394 if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
395  if ( NOT BLAS_LIBRARIES )
396  check_fortran_libraries(
397  BLAS_LIBRARIES
398  BLAS
399  cblas_dgemm
400  ""
401  "vecLib"
402  ""
403  )
404  endif ( NOT BLAS_LIBRARIES )
405 endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
406 # Generic BLAS library?
407 if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
408  if(NOT BLAS_LIBRARIES)
409  check_fortran_libraries(
410  BLAS_LIBRARIES
411  BLAS
412  sgemm
413  ""
414  "blas"
415  ""
416  )
417  endif(NOT BLAS_LIBRARIES)
418 endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
419 
420 #BLAS in intel mkl 10 library? (em64t 64bit)
421 if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
422  if (NOT WIN32)
423  set(LM "-lm")
424  endif ()
425  if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
426  if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
427  find_package(Threads)
428  else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
429  find_package(Threads REQUIRED)
430  endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
431  if (WIN32)
432  if(BLA_F95)
433  if(NOT BLAS95_LIBRARIES)
434  check_fortran_libraries(
435  BLAS95_LIBRARIES
436  BLAS
437  sgemm
438  ""
439  "mkl_blas95;mkl_intel_c;mkl_intel_thread;mkl_core;libguide40"
440  ""
441  )
442  endif(NOT BLAS95_LIBRARIES)
443  else(BLA_F95)
444  if(NOT BLAS_LIBRARIES)
445  check_fortran_libraries(
446  BLAS_LIBRARIES
447  BLAS
448  SGEMM
449  ""
450  "mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40"
451  ""
452  )
453  endif(NOT BLAS_LIBRARIES)
454  endif(BLA_F95)
455  else(WIN32)
456  if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
457  if(BLA_F95)
458  if(NOT BLAS95_LIBRARIES)
459  check_fortran_libraries(
460  BLAS95_LIBRARIES
461  BLAS
462  sgemm
463  ""
464  "mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide"
465  "${CMAKE_THREAD_LIBS_INIT};${LM}"
466  )
467  endif(NOT BLAS95_LIBRARIES)
468  else(BLA_F95)
469  if(NOT BLAS_LIBRARIES)
470  check_fortran_libraries(
471  BLAS_LIBRARIES
472  BLAS
473  sgemm
474  ""
475  "mkl_intel;mkl_intel_thread;mkl_core;guide"
476  "${CMAKE_THREAD_LIBS_INIT}"
477  "${LM}"
478  )
479  endif(NOT BLAS_LIBRARIES)
480  endif(BLA_F95)
481  endif (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
482  if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
483  if(BLA_F95)
484  if(NOT BLAS95_LIBRARIES)
485  check_fortran_libraries(
486  BLAS95_LIBRARIES
487  BLAS
488  sgemm
489  ""
490  "mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
491  "${CMAKE_THREAD_LIBS_INIT};${LM}"
492  )
493  endif(NOT BLAS95_LIBRARIES)
494  else(BLA_F95)
495  if(NOT BLAS_LIBRARIES)
496  check_fortran_libraries(
497  BLAS_LIBRARIES
498  BLAS
499  sgemm
500  ""
501  "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
502  "${CMAKE_THREAD_LIBS_INIT};${LM}"
503  )
504  endif(NOT BLAS_LIBRARIES)
505  endif(BLA_F95)
506  endif (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
507  endif (WIN32)
508  #older vesions of intel mkl libs
509  # BLAS in intel mkl library? (shared)
510  if(NOT BLAS_LIBRARIES)
511  check_fortran_libraries(
512  BLAS_LIBRARIES
513  BLAS
514  sgemm
515  ""
516  "mkl;guide"
517  "${CMAKE_THREAD_LIBS_INIT};${LM}"
518  )
519  endif(NOT BLAS_LIBRARIES)
520  #BLAS in intel mkl library? (static, 32bit)
521  if(NOT BLAS_LIBRARIES)
522  check_fortran_libraries(
523  BLAS_LIBRARIES
524  BLAS
525  sgemm
526  ""
527  "mkl_ia32;guide"
528  "${CMAKE_THREAD_LIBS_INIT};${LM}"
529  )
530  endif(NOT BLAS_LIBRARIES)
531  #BLAS in intel mkl library? (static, em64t 64bit)
532  if(NOT BLAS_LIBRARIES)
533  check_fortran_libraries(
534  BLAS_LIBRARIES
535  BLAS
536  sgemm
537  ""
538  "mkl_em64t;guide"
539  "${CMAKE_THREAD_LIBS_INIT};${LM}"
540  )
541  endif(NOT BLAS_LIBRARIES)
542  endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
543 endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
544 
545 if (BLAS_LIBRARIES_VARS)
546  mark_as_advanced (FORCE ${BLAS_LIBRARIES_VARS})
547 endif ()
548 if (BLAS95_LIBRARIES)
549  mark_as_advanced (FORCE ${BLAS95_LIBRARIES})
550 endif ()
551 if (BLAS_INCLUDE_DIR)
552  mark_as_advanced (FORCE BLAS_INCLUDE_DIR)
553 endif ()
554 
555 if(BLA_F95)
556  if(BLAS95_LIBRARIES)
557  set(BLAS95_FOUND TRUE)
558  else(BLAS95_LIBRARIES)
559  set(BLAS95_FOUND FALSE)
560  endif(BLAS95_LIBRARIES)
561 
562  if(NOT BLAS_FIND_QUIETLY)
563  if(BLAS95_FOUND)
564  mark_as_advanced (${BLAS95_LIBRARIES})
565  message(STATUS "A library with BLAS95 API found.")
566  else(BLAS95_FOUND)
567  if(BLAS_FIND_REQUIRED)
568  mark_as_advanced (CLEAR ${BLAS95_LIBRARIES})
569  message(FATAL_ERROR
570  "A required library with BLAS95 API not found. Please specify library location.")
571  else(BLAS_FIND_REQUIRED)
572  message(STATUS
573  "A library with BLAS95 API not found. Please specify library location.")
574  endif(BLAS_FIND_REQUIRED)
575  endif(BLAS95_FOUND)
576  endif(NOT BLAS_FIND_QUIETLY)
577  set(BLAS_FOUND TRUE)
578  set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
579 else(BLA_F95)
580  if(BLAS_LIBRARIES)
581  if(BLAS_LIBRARIES_VARS MATCHES "cblas" AND NOT BLAS_INCLUDE_DIR)
582  set(BLAS_FOUND FALSE)
583  else()
584  set(BLAS_FOUND TRUE)
585  endif()
586  else(BLAS_LIBRARIES)
587  set(BLAS_FOUND FALSE)
588  endif(BLAS_LIBRARIES)
589 
590  if(NOT BLAS_FIND_QUIETLY)
591  if(BLAS_FOUND)
592  message(STATUS "A library with BLAS API found.")
593  else(BLAS_FOUND)
594  if(BLAS_LIBRARIES AND BLAS_cblas_LIBRARY AND NOT BLAS_INCLUDE_DIR)
595  if(BLAS_FIND_REQUIRED)
596  mark_as_advanced (CLEAR BLAS_INCLUDE_DIR)
597  message(FATAL_ERROR
598  "Location of cblas.h header file for C BLAS library not found!"
599  " Please specify the directory containing this file for library ${BLAS_cblas_LIBRARY}"
600  " using the BLAS_INCLUDE_DIR variable."
601  )
602  else(BLAS_FIND_REQUIRED)
603  message(STATUS
604  "Location of cblas.h header file for C BLAS library not found! Please specify header location."
605  )
606  endif(BLAS_FIND_REQUIRED)
607  else()
608  if(BLAS_FIND_REQUIRED)
609  mark_as_advanced (CLEAR ${BLAS_LIBRARIES_VARS})
610  message(FATAL_ERROR
611  "A required library with BLAS API not found. Please specify library location"
612  " by setting the following variables: [${BLAS_LIBRARIES_VARS}]."
613  )
614  else(BLAS_FIND_REQUIRED)
615  message(STATUS
616  "A library with BLAS API not found. Please specify library location."
617  )
618  endif(BLAS_FIND_REQUIRED)
619  endif()
620  endif(BLAS_FOUND)
621  endif(NOT BLAS_FIND_QUIETLY)
622 endif(BLA_F95)
623 
624 unset(BLAS_LIBRARIES_VARS)
cmake BLAS_LIBRARIES
Definition: FindBLAS.cmake:578
cmake BLA_VENDOR
Definition: FindBLAS.cmake:161
cmake CMAKE_FIND_LIBRARY_SUFFIXES
Definition: FindGMock.cmake:80
macro Check_Fortran_Libraries(in LIBRARIES, in _prefix, in _name, in _flags, in _list, in _threads)
cmake _ACML_PATH_SUFFIX
Definition: FindBLAS.cmake:299
cmake LM
Definition: FindBLAS.cmake:423
cmake _CHECK_FORTRAN
Definition: FindBLAS.cmake:45
cmake _ACML_COMPILER64
Definition: FindBLAS.cmake:305
cmake _ACML_COMPILER32
Definition: FindBLAS.cmake:304
cmake CXX
cmake BLAS_LINKER_FLAGS
Definition: FindBLAS.cmake:239
cmake _prefix
if(oldcoutbuf)
function get_filename_component(inout ARGN)
Fixes CMake's get_filename_component() command.