$NetBSD: patch-LAPACKE_CMakeLists.txt,v 1.2 2021/05/12 14:32:51 thor Exp $ Support combined build of shared and static libraries. --- LAPACKE/CMakeLists.txt.orig 2021-03-25 18:25:15.000000000 +0000 +++ LAPACKE/CMakeLists.txt @@ -99,6 +99,25 @@ install( DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT Development ) +if(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) + add_library(${LAPACKELIB}_static STATIC ${SOURCES}) + set_target_properties( + ${LAPACKELIB}_static PROPERTIES + LINKER_LANGUAGE C + OUTPUT_NAME ${LAPACKELIB} + ) + target_include_directories(${LAPACKELIB}_static PUBLIC + $ + $ + ) + + if(LAPACKE_WITH_TMG) + target_link_libraries(${LAPACKELIB}_static PRIVATE tmglib) + endif() + target_link_libraries(${LAPACKELIB}_static PRIVATE ${LAPACK_LIBRARIES}) + + lapack_install_library(${LAPACKELIB}_static) +endif() if(BUILD_TESTING) add_subdirectory(example) @@ -126,7 +145,8 @@ install(FILES COMPONENT Development ) -install(EXPORT ${LAPACKELIB}-targets - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LAPACKELIB}-${LAPACK_VERSION} - COMPONENT Development - ) +# What is broken here? CMake erros out with unknown lapacke-targets. +#install(EXPORT ${LAPACKELIB}-targets +# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LAPACKELIB}-${LAPACK_VERSION} +# COMPONENT Development +# )