Skip to content
Snippets Groups Projects

Draft: Add dependency registry to keep track of exported library dependencies

Closed Santiago Ospina De Los Ríos requested to merge feature/dependency-registry into master
12 files
+ 105
39
Compare changes
  • Side-by-side
  • Inline
Files
12
@@ -20,13 +20,22 @@ set_package_properties("BLAS" PROPERTIES
set_package_properties("LAPACK" PROPERTIES
DESCRIPTION "fast linear algebra routines")
find_package(LAPACK)
set_property(GLOBAL APPEND PROPERTY DUNE_DEPENDENCY_REGISRTY "BLAS")
set_property(GLOBAL PROPERTY DUNE_DEPENDENCY_REGISRTY_BLAS "include(AddBLASLapackFlags)")
set_property(GLOBAL APPEND PROPERTY DUNE_DEPENDENCY_REGISRTY "LAPACK")
set_property(GLOBAL PROPERTY DUNE_DEPENDENCY_REGISRTY_LAPACK "include(AddBLASLapackFlags)")
# register HAVE_BLAS and HAVE_LAPACK for config.h
set(HAVE_BLAS ${BLAS_FOUND})
set(HAVE_LAPACK ${LAPACK_FOUND})
# register Lapack library as dune package
include(DuneEnableAllPackages)
if(HAVE_LAPACK)
dune_register_package_flags(LIBRARIES "${LAPACK_LIBRARIES}")
dune_register_package_flags(
LIBRARIES "${LAPACK_LIBRARIES}"
COMPILE_DEFINITIONS "ENABLE_LAPACK=1")
include(CMakePushCheckState)
cmake_push_check_state()
@@ -34,7 +43,9 @@ if(HAVE_LAPACK)
check_function_exists("dsyev_" LAPACK_NEEDS_UNDERLINE)
cmake_pop_check_state()
elseif(HAVE_BLAS)
dune_register_package_flags(LIBRARIES "${BLAS_LIBRARIES}")
dune_register_package_flags(
LIBRARIES "${BLAS_LIBRARIES}"
COMPILE_DEFINITIONS "ENABLE_BLAS=1")
endif()
# add function to link against the BLAS/Lapack library
@@ -42,8 +53,10 @@ function(add_dune_blas_lapack_flags _targets)
foreach(_target ${_targets})
if(LAPACK_FOUND)
target_link_libraries(${_target} PUBLIC ${LAPACK_LIBRARIES})
target_compile_definitions(${_target} PUBLIC ENABLE_LAPACK=1)
elseif(BLAS_FOUND)
target_link_libraries(${_target} PUBLIC ${BLAS_LIBRARIES})
target_compile_definitions(${_target} PUBLIC ENABLE_BLAS=1)
endif()
endforeach(_target)
endfunction(add_dune_blas_lapack_flags)
Loading