diff -Naur a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt 2021-12-27 21:45:42.000000000 -0800
+++ b/CMakeLists.txt 2023-10-19 10:47:52.662553623 -0700
@@ -10,6 +10,7 @@
include(CheckIncludeFile)
include (CheckSymbolExists)
+include(GNUInstallDirs)
option(DOWNLOAD_EIGEN "Download eigen if it isn't installed on the system" ON)
option(USE_EIGEN "Use eigen for math operations" DOWNLOAD_EIGEN)
diff -Naur a/src/CMakeLists.txt b/src/CMakeLists.txt
--- a/src/CMakeLists.txt 2021-12-27 21:45:42.000000000 -0800
+++ b/src/CMakeLists.txt 2023-10-19 17:46:36.602617199 -0700
@@ -52,13 +52,19 @@
message("Using blas backend ${BLAS_BACKEND}")
endif()
-add_library(cnmatrix STATIC ${CN_MATRIX_SRCS})
+add_library(cnmatrix SHARED ${CN_MATRIX_SRCS})
+add_library(cnmatrix_static STATIC ${CN_MATRIX_SRCS})
target_include_directories(cnmatrix PUBLIC
$
$
)
+target_include_directories(cnmatrix_static PUBLIC
+ $
+ $
+ )
set_target_properties(cnmatrix PROPERTIES FOLDER "libraries")
+set_target_properties(cnmatrix PROPERTIES SOVERSION 0.0)
IF(USE_EIGEN)
add_definitions ( ${EIGEN3_DEFINITIONS} )
@@ -72,6 +78,7 @@
ELSE()
IF(UNIX)
target_link_libraries(cnmatrix ${BLAS_BACKEND} ${LAPACKE_LOCATION} m)
+ target_link_libraries(cnmatrix_static ${BLAS_BACKEND} ${LAPACKE_LOCATION} m)
elseif(WIN32)
include_directories(${CMAKE_BINARY_DIR}/packages/OpenBLAS.0.2.14.1/lib/native/include/)
target_link_libraries(cnmatrix
@@ -80,4 +87,4 @@
ENDIF()
ENDIF()
-install(TARGETS cnmatrix DESTINATION lib)
+install(TARGETS cnmatrix DESTINATION ${CMAKE_INSTALL_LIBDIR})
diff -Naur a/tests/CMakeLists.txt b/tests/CMakeLists.txt
--- a/tests/CMakeLists.txt 2021-12-27 21:45:42.000000000 -0800
+++ b/tests/CMakeLists.txt 2023-10-19 17:45:35.976399562 -0700
@@ -1,6 +1,6 @@
include_directories(../include)
add_executable(cnmatrix_test cn_matrixtest.c)
-target_link_libraries(cnmatrix_test cnmatrix)
+target_link_libraries(cnmatrix_test cnmatrix_static)
add_test(cnmatrix_test cnmatrix_test)