Salome HOME
spns #32755 : TopIIVolMesh: move back to master branch
[tools/sat_salome.git] / products / patches / cminpack-1.3.6-cblas.patch
1 diff -Naur cminpack_ref/CMakeLists.txt  cminpack_new/CMakeLists.txt
2 --- cminpack_ref/CMakeLists.txt 2017-02-24 16:09:31.000000000 +0100
3 +++ cminpack_new/CMakeLists.txt 2021-11-01 17:02:44.829569251 +0100
4 @@ -41,6 +41,7 @@
5  endif ()
6  
7  option(USE_BLAS "Compile cminpack using a blas library if possible" ON)
8 +option(CBLAS_INCLUDE_DIRS "On CentOS8 -  CMake fails to find /usr/include/cblas" "")
9  
10  #set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/../build)
11  
12 @@ -69,14 +70,28 @@
13  
14  # Link with a BLAS library if requested
15  if (USE_BLAS)
16 +  SET(LAPACK_ROOT_DIR $ENV{LAPACK_ROOT_DIR} CACHE PATH "Path to the LAPACK.")
17 +  IF(LAPACK_ROOT_DIR)
18 +    LIST(APPEND CMAKE_PREFIX_PATH "${LAPACK_ROOT_DIR}")
19 +  ENDIF(LAPACK_ROOT_DIR)
20    if (NOT BUILD_SHARED_LIBS)
21      set(BLA_STATIC True)
22    endif()
23    find_package(BLAS)
24    if (BLAS_FOUND)
25 -    target_link_libraries(cminpack PUBLIC ${BLAS_LIBRARIES})
26 +    MESSAGE(STATUS "Searching for C-BLAS library...")
27 +    FIND_LIBRARY(CBLAS_LIBRARIES NAMES cblas
28 +      HINTS ${LAPACK_ROOT_DIR}
29 +      PATH_SUFFIXES lib
30 +      PATHS ${LAPACK_ROOT_DIR}
31 +    )
32 +
33 +    target_link_libraries(cminpack PUBLIC ${BLAS_LIBRARIES} ${CBLAS_LIBRARIES})
34      set_target_properties(cminpack PROPERTIES LINK_FLAGS "${BLAS_LINKER_FLAGS}")
35      target_compile_definitions(cminpack PUBLIC -DUSE_CBLAS)
36 +    if (CBLAS_INCLUDE_DIRS)
37 +      include_directories(${CBLAS_INCLUDE_DIRS})
38 +    endif(CBLAS_INCLUDE_DIRS)
39    endif()
40  endif()
41  
42 @@ -94,4 +109,4 @@
43  set_target_properties(cminpack PROPERTIES VERSION ${CMINPACK_VERSION} SOVERSION ${CMINPACK_SOVERSION})
44  
45  add_subdirectory (cmake)
46 -add_subdirectory (examples)
47 \ No newline at end of file
48 +add_subdirectory (examples)