File: enable_shared_and_static.patch

package info (click to toggle)
libedlib 1.2.7-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,532 kB
  • sloc: cpp: 2,002; sh: 304; python: 131; makefile: 89; ansic: 7
file content (40 lines) | stat: -rw-r--r-- 1,268 bytes parent folder | download | duplicates (3)
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
Description: Enable building both shared and static library for d-shlibs
Author: Nilesh Patra <npatra974@gmail.com>,
        tony mancill <tmancill@debian.org>
Forwarded: not-needed
Last-Update: 2021-12-29
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,7 +51,13 @@
 file(GLOB SOURCES "edlib/src/*.cpp")
 
 # Create libraries.
-add_library(edlib ${SOURCES})
+add_library(edlib SHARED ${SOURCES})
+
+add_library(edlib_static STATIC ${SOURCES})
+target_include_directories(edlib_static PUBLIC
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/edlib/include>
+    $<INSTALL_INTERFACE:include>)
+
 add_library(edlib::edlib ALIAS edlib)
 set_target_properties(edlib
   PROPERTIES
@@ -87,7 +93,7 @@
 if(EDLIB_BUILD_UTILITIES)
   if(NOT WIN32) # If on windows, do not build binaries that do not support windows.
     add_executable(edlib-aligner apps/aligner/aligner.cpp)
-    target_link_libraries(edlib-aligner edlib)
+    target_link_libraries(edlib-aligner edlib_static)
   endif()
 endif()
 
@@ -136,7 +142,7 @@
   
   # Create target 'install' for installing libraries.
   install(
-    TARGETS edlib
+    TARGETS edlib edlib_static
     EXPORT ${targets_export_name} 
     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}