summaryrefslogtreecommitdiffstats
path: root/src/proto
diff options
context:
space:
mode:
authorJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2019-09-15 23:23:38 +0200
committerJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2019-10-24 19:12:40 +0200
commit0faa0f3c8981e6ecc593d06ba42beb903fb2491b (patch)
treefbff02ad2d89775f2bb22e941aeb242aa3a3c667 /src/proto
parentdf8a79529dabd41106c278607d36e5af4679e21b (diff)
CMake: Allow protobuf-lite libraries
Diffstat (limited to 'src/proto')
-rw-r--r--src/proto/CMakeLists.txt16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/proto/CMakeLists.txt b/src/proto/CMakeLists.txt
index cfe859db2a..156e9fb09b 100644
--- a/src/proto/CMakeLists.txt
+++ b/src/proto/CMakeLists.txt
@@ -1,5 +1,5 @@
# Protobuf
-find_package(Protobuf REQUIRED)
+find_package(Protobuf)
protobuf_generate_cpp(
PROTO_SOURCES
PROTO_HEADERS
@@ -9,5 +9,15 @@ protobuf_generate_cpp(
skin.proto
waveform.proto
)
-add_library(mixxx-proto OBJECT ${PROTO_SOURCES} ${PROTO_HEADERS})
-target_link_libraries(mixxx-proto PUBLIC protobuf::libprotobuf)
+
+add_library(mixxx-proto STATIC ${PROTO_SOURCES} ${PROTO_HEADERS})
+
+# Use uppercase PROTOBUF_ prefix for backwards compatibility for CMake < 3.6.0
+target_include_directories(mixxx-proto PUBLIC ${PROTOBUF_INCLUDE_DIR})
+if(PROTOBUF_INCLUDE_DIR AND PROTOBUF_LIBRARIES)
+ target_link_libraries(mixxx-proto PUBLIC ${PROTOBUF_LIBRARIES})
+elseif(PROTOBUF_INCLUDE_DIR AND PROTOBUF_LITE_LIBRARY)
+ target_link_libraries(mixxx-proto PUBLIC ${PROTOBUF_LITE_LIBRARY})
+else()
+ message(FATAL_ERROR "Protobuf or Protobuf-lite libraries are required to compile Mixxx.")
+endif()