summaryrefslogtreecommitdiff
path: root/app-text/editorconfig-core-c/files/editorconfig-core-c-0.12.3-no-static-libs.patch
blob: 369b806467be862ca3cefc08e155db0be11f97e2 (plain)
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
61
62
63
64
65
66
67
68
69
From 4fa85f00f824b1dd5d1244c77667ea497d94f02b Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <asturm@gentoo.org>
Date: Sat, 11 Jul 2020 21:11:58 +0200
Subject: [PATCH] Do not build static lib if BUILD_STATICALLY_LINKED_EXE=OFF

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
 src/lib/CMakeLists.txt | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 353ab1c..12db621 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -44,16 +44,18 @@ if(WIN32)
 endif()
 target_link_libraries(editorconfig_shared ${PCRE2_LIBRARIES})
 
-add_library(editorconfig_static STATIC ${editorconfig_LIBSRCS})
-set_target_properties(editorconfig_static PROPERTIES
-    OUTPUT_NAME editorconfig_static
-    VERSION ${PROJECT_VERSION})
+if(BUILD_STATICALLY_LINKED_EXE)
+    add_library(editorconfig_static STATIC ${editorconfig_LIBSRCS})
+    set_target_properties(editorconfig_static PROPERTIES
+        OUTPUT_NAME editorconfig_static
+        VERSION ${PROJECT_VERSION})
 
-# We need to link Shwapi since we use PathIsRelative
-if(WIN32)
-    target_link_libraries(editorconfig_static Shlwapi)
+    # We need to link Shwapi since we use PathIsRelative
+    if(WIN32)
+        target_link_libraries(editorconfig_static Shlwapi)
+    endif()
+    target_link_libraries(editorconfig_static ${PCRE2_LIBRARIES})
 endif()
-target_link_libraries(editorconfig_static ${PCRE2_LIBRARIES})
 
 # EditorConfig package name for find_package() and the CMake package registry.
 # On UNIX the system registry is usually just "lib/cmake/<package>".
@@ -65,11 +67,19 @@ set(editorconfig_CONFIG_EXPORT_NAME "${config_package_name}Targets")
 set(editorconfig_CONFIG_INSTALL_LIBDIR
     "${CMAKE_INSTALL_LIBDIR}/cmake/${config_package_name}")
 
-install(TARGETS editorconfig_shared editorconfig_static
-    EXPORT ${editorconfig_CONFIG_EXPORT_NAME}
-    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
-    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+if(BUILD_STATICALLY_LINKED_EXE)
+    install(TARGETS editorconfig_static
+        EXPORT ${editorconfig_CONFIG_EXPORT_NAME}
+        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+else()
+    install(TARGETS editorconfig_shared
+        EXPORT ${editorconfig_CONFIG_EXPORT_NAME}
+        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 configure_file(
     ${CMAKE_CURRENT_SOURCE_DIR}/editorconfig.pc.in
-- 
2.27.0