Skip to content

Commit

Permalink
Problem when changing from macro to function
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayeul d'Avezac committed Feb 4, 2016
1 parent 2a546d8 commit 01c54b7
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions modules/FindCBLAS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ function(_look_for_blas_libraries)
if(NOT CBLAS_FOUND AND PKG_CONFIG_FOUND)
pkg_search_module(ATLAS atlas)
else()
set(BLAS_LIBRARIES ${CBLAS_LIBRARIES} PARENT_SCOPE)
set(BLAS_INCLUDE_DIR ${CBLAS_INCLUDE_DIRS} PARENT_SCOPE)
set(BLAS_LIBRARIES ${CBLAS_LIBRARIES})
set(BLAS_INCLUDE_DIR ${CBLAS_INCLUDE_DIRS})
endif()

# include -pthread so MKL can be included on Ubuntu + enthought
if(use_pthread_flag)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread" PARENT_SCOPE)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")
endif()
find_package(BLAS QUIET)
if(use_pthread_flag)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} PARENT_SCOPE)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread" PARENT_SCOPE)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")
endif()

# Figures out atlas if necessary
Expand All @@ -58,29 +58,37 @@ function(_look_for_blas_libraries)
HINTS "${atlas_dir}"
)
if(BLAS_atlas_cblas_LIBRARY)
set(BLAS_FOUND TRUE PARENT_SCOPE)
set(BLAS_FOUND TRUE)
set(BLAS_LIBRARIES
"${BLAS_atlas_cblas_LIBRARY}"
"${BLAS_atlas_LIBRARY}"
PARENT_SCOPE
)
endif()
endif()

# Try open-blas
if(NOT BLAS_LIBRARIES AND NOT BLAS_INCLUDE_DIR)
find_package(OpenBLAS)
if(NOT BLAS_LIBRARIES OR NOT BLAS_INCLUDE_DIR)
find_package(OpenBLAS QUIET)
if(OpenBLAS_FOUND)
if(NOT EXISTS "${OpenBLAS_LIBRARIES}")
string(REPLACE "'" "" OpenBLAS_LIBRARIES ${OpenBLAS_LIBRARIES})
endif()
if(NOT EXISTS "${OpenBLAS_INCLUDE_DIRS}")
string(REPLACE "'" "" OpenBLAS_INCLUDE_DIRS ${OpenBLAS_INCLUDE_DIRS})
endif()
set(BLAS_LIBRARIES ${OpenBLAS_LIBRARIES} PARENT_SCOPE)
set(BLAS_INCLUDE_DIR ${OpenBLAS_INCLUDE_DIRS} PARENT_SCOPE)
set(BLAS_LIBRARIES ${OpenBLAS_LIBRARIES})
set(BLAS_INCLUDE_DIR ${OpenBLAS_INCLUDE_DIRS})
endif()
endif()
if(BLAS_FOUND)
set(BLAS_FOUND TRUE PARENT_SCOPE)
endif()
if(BLAS_LIBRARIES)
set(BLAS_LIBRARIES "${BLAS_LIBRARIES}" PARENT_SCOPE)
endif()
if(BLAS_INCLUDE_DIR)
set(BLAS_INCLUDE_DIR "${BLAS_INCLUDE_DIR}" PARENT_SCOPE)
endif()
endfunction()

function(_look_for_include_directories)
Expand Down

0 comments on commit 01c54b7

Please sign in to comment.