$NetBSD: patch-SRC_CMakeLists.txt,v 1.3 2021/06/01 22:13:35 thor Exp $ Support combined build of shared and static libraries. --- SRC/CMakeLists.txt.orig 2021-03-25 18:25:15.000000000 +0000 +++ SRC/CMakeLists.txt @@ -518,3 +518,23 @@ if(_is_coverage_build) endif() lapack_install_library(${LAPACKLIB}) +if(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) + add_library(${LAPACKLIB}_static STATIC ${SOURCES}) + set_target_properties( + ${LAPACKLIB}_static PROPERTIES + OUTPUT_NAME ${LAPACKLIB} + ) + + if(USE_XBLAS) + target_link_libraries(${LAPACKLIB}_static PRIVATE ${XBLAS_LIBRARY}) + endif() + target_link_libraries(${LAPACKLIB}_static PRIVATE ${BLAS_LIBRARIES}) + + if (_is_coverage_build) + target_link_libraries(${LAPACKLIB}_static PRIVATE gcov) + add_coverage(${LAPACKLIB}_static) + endif() + + lapack_install_library(${LAPACKLIB}_static) +endif() +