summaryrefslogtreecommitdiff
blob: bfc7e8701a5d4f6218c0f8227b190002e1fc417d (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
Upstream: no, I probably should, although this patch isn't nice, but
          neither is their cmake code

From a0c72f32b3c318f66975400af81b9b44d8a8d9c7 Mon Sep 17 00:00:00 2001
From: Heiko Becker <heirecka@exherbo.org>
Date: Wed, 27 Mar 2019 21:07:22 +0100
Subject: [PATCH] Fix build with BUILD_STATIC_LIB=ON

---
 cpp/CMakeLists.txt | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 38ce1f50..dd9399be 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -441,7 +441,9 @@ if (${BUILD_GEOCODER} STREQUAL "ON")
   list (APPEND GEOCODER_DEPS ${COMMON_DEPS})
   # Note that the subset of base/ on which the geocoder relies is implemented
   # on top of Boost header-only libraries (e.g. scoped_ptr.hpp).
-  target_link_libraries (geocoding ${LIBRARY_DEPS})
+  if (${BUILD_STATIC_LIB} STREQUAL "ON")
+    target_link_libraries (geocoding ${LIBRARY_DEPS})
+  endif()
   target_link_libraries (geocoding-shared ${LIBRARY_DEPS})
 endif ()
 
@@ -599,7 +601,9 @@ if (BUILD_SHARED_LIB)
 endif ()
 
 if (${BUILD_GEOCODER} STREQUAL "ON")
-  install (TARGETS geocoding LIBRARY DESTINATION ${LIBDIR} ARCHIVE DESTINATION ${LIBDIR})
+  if (${BUILD_STATIC_LIB} STREQUAL "ON")
+    install (TARGETS geocoding LIBRARY DESTINATION ${LIBDIR} ARCHIVE DESTINATION ${LIBDIR})
+  endif()
   install (TARGETS geocoding-shared LIBRARY DESTINATION ${LIBDIR} ARCHIVE
            DESTINATION ${LIBDIR})
 endif ()
@@ -611,7 +615,11 @@ if (${BUILD_GEOCODER} STREQUAL "ON")
     geocoding_test_program
     "test/phonenumbers/geocoding/geocoding_test_program.cc"
   )
-  target_link_libraries (geocoding_test_program geocoding phonenumber)
+  if (${BUILD_STATIC_LIB} STREQUAL "ON")
+    target_link_libraries (geocoding_test_program geocoding phonenumber)
+  else ()
+    target_link_libraries (geocoding_test_program geocoding-shared phonenumber-shared)
+  endif ()
 endif ()
 
 # Build an RPM
-- 
2.21.0