1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
Author: Andreas Tille <tille@debian.org>
Last-Update: 2022-06-29
Description: Enable static and shared library
--- libslow5lib.orig/CMakeLists.txt
+++ libslow5lib/CMakeLists.txt
@@ -54,19 +54,34 @@
# add_executable(slow5exmp ${openmp_get_reads})
-option(SLOW5_LINK_STATIC "libslow5 will create a static lib" OFF) #OFF by default
-if(SLOW5_LINK_STATIC)
- message( STATUS "libslow5 will create a static lib" )
- add_library(slow5 STATIC ${slow5_} ${slow5_idx} ${slow5_misc} ${slow5_press} ${slow5_mt})
-else()
- message( STATUS "libslow5 will create a shared lib" )
+#option(SLOW5_LINK_STATIC "libslow5 will create a static lib" OFF) #OFF by default
+#if(SLOW5_LINK_STATIC)
+# message( STATUS "libslow5 will create a static lib" )
+# add_library(slow5 STATIC ${slow5_} ${slow5_idx} ${slow5_misc} ${slow5_press} ${slow5_mt})
+#else()
+# message( STATUS "libslow5 will create a shared lib" )
+ add_library(slow5_static STATIC ${slow5_} ${slow5_idx} ${slow5_misc} ${slow5_press} ${slow5_mt})
add_library(slow5 SHARED ${slow5_} ${slow5_idx} ${slow5_misc} ${slow5_press} ${slow5_mt})
-endif(SLOW5_LINK_STATIC)
-unset(SLOW5_LINK_STATIC CACHE)
+#endif(SLOW5_LINK_STATIC)
+#unset(SLOW5_LINK_STATIC CACHE)
+set_target_properties(slow5 PROPERTIES
+ SOVERSION 0
+)
+
+target_include_directories(slow5_static PUBLIC ${PROJECT_SOURCE_DIR}/include)
+target_link_libraries(slow5_static)
target_include_directories(slow5 PUBLIC ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(slow5)
+set(slow5_targets slow5 slow5_static)
+
+target_compile_definitions(slow5_static PUBLIC _GLIBCXX_DEBUG) # PUBLIC to maintain ABI compatibility
+target_compile_definitions(slow5 PUBLIC _GLIBCXX_DEBUG) # PUBLIC to maintain ABI compatibility
+
+target_include_directories(slow5_static PUBLIC include)
+target_include_directories(slow5 PUBLIC include)
+
# Build a static lib
#add_library(slow5 STATIC ${slow5_} ${slow5_idx} ${slow5_misc} ${slow5_press})
#
@@ -85,3 +100,10 @@
# target_link_libraries(slow5test slow5 streamvbyte_slow5 -lz -ldl -lm)
# target_link_libraries(slow5exmp slow5 streamvbyte_slow5 -lz -ldl -lm)
# ENDIF()
+
+install (
+ TARGETS slow5
+ TARGETS slow5 slow5_static
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
|