From 01c54b7b47ae7415ff90db3d6cfd7552a47fcfe5 Mon Sep 17 00:00:00 2001 From: Mayeul d'Avezac Date: Thu, 4 Feb 2016 11:54:47 +0000 Subject: [PATCH] Problem when changing from macro to function --- modules/FindCBLAS.cmake | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/modules/FindCBLAS.cmake b/modules/FindCBLAS.cmake index 9d6b2c1..de2e505 100644 --- a/modules/FindCBLAS.cmake +++ b/modules/FindCBLAS.cmake @@ -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 @@ -58,18 +58,17 @@ 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}) @@ -77,10 +76,19 @@ function(_look_for_blas_libraries) 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)