Do not build shared libs if not supported

(cherry picked from commit 09d7122468)
This commit is contained in:
Daniel N. Miller (APD)
2021-06-23 21:09:53 -07:00
committed by Rasmus Munk Larsen
parent 4240b480e0
commit 1e9f623f3e
3 changed files with 37 additions and 23 deletions

View File

@@ -26,20 +26,27 @@ else()
set(EigenBlas_SRCS ${EigenBlas_SRCS} f2c/complexdots.c)
endif()
add_library(eigen_blas_static ${EigenBlas_SRCS})
add_library(eigen_blas SHARED ${EigenBlas_SRCS})
set(EIGEN_BLAS_TARGETS "")
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
target_link_libraries(eigen_blas_static ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
target_link_libraries(eigen_blas ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
add_library(eigen_blas_static ${EigenBlas_SRCS})
list(APPEND EIGEN_BLAS_TARGETS eigen_blas_static)
if (EIGEN_BUILD_SHARED_LIBS)
add_library(eigen_blas SHARED ${EigenBlas_SRCS})
list(APPEND EIGEN_BLAS_TARGETS eigen_blas)
endif()
add_dependencies(blas eigen_blas eigen_blas_static)
foreach(target IN LISTS EIGEN_BLAS_TARGETS)
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
target_link_libraries(${target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
endif()
install(TARGETS eigen_blas eigen_blas_static
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
add_dependencies(blas ${target})
install(TARGETS ${target}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endforeach()
if(EIGEN_Fortran_COMPILER_WORKS)