diff --git a/CMakeLists.txt b/CMakeLists.txt index 15bff703a05ca689ac47381d2a9d7d277ac70dd7..d4cc9ea04610d0609505b87a609d7f4d625c5816 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,8 +93,8 @@ endif() set(ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}) set(SRC_DIR ${ROOT_DIR}/src) set(PROJECT_BINARY_DIR ${ROOT_DIR}/build) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY lib) -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) #----------------------------------------# @@ -188,18 +188,20 @@ if(NOT ARMADILLO_FOUND AND ALLOW_DEPENDENCIES_DOWNLOAD) include(DownloadArmadillo) endif() -#------------------------------------------------------# -# Look for linear algebra libraries neede by Armadillo # -#------------------------------------------------------# +#-------------------------------------------------------# +# Look for linear algebra libraries needed by Armadillo # +#-------------------------------------------------------# set(OpenBLAS_LIBRARIES "") find_package(OpenBLAS) option(OpenBLAS_LOCAL OFF) if(NOT OpenBLAS_FOUND) if(ALLOW_OpenBLAS_DOWNLOAD) + include(DownloadOpenBLAS) set(OpenBLAS_LOCAL ON) - set(OpenBLAS_LIBRARIES ${OpenBLAS_LOCAL_PATH}) + set(OpenBLAS_LIBRARIES "${ROOT_DIR}/external_dependencies/OpenBLAS/lib/${LIB_PREFIX}openblas.${LIB_SUFFIX}") message("OpenBLAS_LIBRARIES ${OpenBLAS_LIBRARIES}") + else() find_package(BLAS) @@ -208,6 +210,7 @@ if(NOT OpenBLAS_FOUND) if(NOT BLAS_FOUND AND NOT LAPACK_FOUND) message(FATAL_ERROR "No BLAS or LAPACK libraries are available!") endif() + endif() endif() diff --git a/DownloadOpenBLAS.cmake b/DownloadOpenBLAS.cmake index 34d6bde96b78ca614c4a08be1fb551971369ad0d..a40b2706a858ecf6b9de3a3c9687ea6d9f1625e6 100644 --- a/DownloadOpenBLAS.cmake +++ b/DownloadOpenBLAS.cmake @@ -13,7 +13,8 @@ FetchContent_Declare( GIT_REPOSITORY https://github.com/xianyi/OpenBLAS.git ) -#set(FETCHCONTENT_QUIET FALSE) +# See messages during 'git clone' +set(FETCHCONTENT_QUIET FALSE) if(NOT OpenBLAS_POPULATED) FetchContent_Populate(OpenBLAS) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4c02f5fc5c164ea6a47bd76af318f253a46d27cb..adcd722e2a5e872a2ad3b0e7e46ac061651a5a5a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -107,7 +107,7 @@ if ("${BUILD_LIB}" STREQUAL "yes") PRE_BUILD COMMAND cmake . COMMAND cmake --build . -j ${N_CORES} - WORKING_DIRECTORY ${OpenBLAS_LOCAL_PATH} + WORKING_DIRECTORY ${ROOT_DIR}/external_dependencies/OpenBLAS COMMENT "Compiling OpenBLAS" ) endif()