aboutsummaryrefslogtreecommitdiff
path: root/ports/protobuf/001-add-compiler-flag.patch
blob: aec510f441164b5a2c6e831c3b731e87b4a88886 (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
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 7618ba21..bd92b09d 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -165,8 +165,11 @@ endif (protobuf_UNICODE)
 
 include(libprotobuf-lite.cmake)
 include(libprotobuf.cmake)
-include(libprotoc.cmake)
-include(protoc.cmake)
+
+if(protobuf_BUILD_COMPILER)
+  include(libprotoc.cmake)
+  include(protoc.cmake)
+endif()
 
 if (protobuf_BUILD_TESTS)
   include(tests.cmake)
diff --git a/cmake/install.cmake b/cmake/install.cmake
index 28dc90dc..52c1f721 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -1,9 +1,12 @@
 include(GNUInstallDirs)
 
+set(LIBRARIES_TO_SET_DEST libprotobuf-lite libprotobuf)
+if(protobuf_BUILD_COMPILER)
+  list(APPEND LIBRARIES_TO_SET_DEST libprotoc)
+endif()
+
 foreach(_library
-  libprotobuf-lite
-  libprotobuf
-  libprotoc)
+  ${LIBRARIES_TO_SET_DEST})
   set_property(TARGET ${_library}
     PROPERTY INTERFACE_INCLUDE_DIRECTORIES
     $<BUILD_INTERFACE:${protobuf_source_dir}/src>
@@ -14,8 +17,10 @@ foreach(_library
     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
 endforeach()
 
-install(TARGETS protoc EXPORT protobuf-targets
-  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
+if(protobuf_BUILD_COMPILER)
+  install(TARGETS protoc EXPORT protobuf-targets
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
+endif()
 
 file(STRINGS extract_includes.bat.in _extract_strings
   REGEX "^copy")
@@ -94,7 +99,12 @@ configure_file(protobuf-options.cmake
   ${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY)
 
 # Allows the build directory to be used as a find directory.
-export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc
+set(FIND_DIRS libprotobuf-lite libprotobuf)
+if(protobuf_BUILD_COMPILER)
+  list(APPEND FIND_DIRS libprotoc protoc)
+endif()
+
+export(TARGETS ${FIND_DIRS}
   NAMESPACE protobuf::
   FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
 )