Skip to content

Commit

Permalink
Make CMake build work with Protobuff v23.4 config mode
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Jul 25, 2023
1 parent 45a3187 commit b4cae36
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2059,7 +2059,7 @@ if(STATIC_DEPS)
mark_as_advanced(Protobuf_USE_STATIC_LIBS)
endif()
add_subdirectory(src/proto)
target_link_libraries(mixxx-lib PRIVATE mixxx-proto)
target_link_libraries(mixxx-lib PUBLIC mixxx-proto)

# Rigtorp SPSC Queue
# https://github.com/rigtorp/SPSCQueue
Expand Down
19 changes: 10 additions & 9 deletions src/proto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
# Protobuf

# first try the package provided config
find_package(Protbuf CONFIG QUIET)
find_package(Protbuf CONFIG REQUIRED)
if(NOT Protbuf_FOUND)
# Fall back to the CMake provide module
find_package(Protobuf MODULE REQUIRED)
endif()

add_library(mixxx-proto OBJECT)

if(TARGET protobuf::libprotobuf-lite)
target_link_libraries(mixxx-proto PUBLIC protobuf::libprotobuf-lite)
elseif(TARGET protobuf::libprotobuf)
target_link_libraries(mixxx-proto PUBLIC protobuf::libprotobuf)
else()
message(FATAL_ERROR "Protobuf or Protobuf-lite libraries are required to compile Mixxx.")
endif()

protobuf_generate(
LANGUAGE cpp
TARGET mixxx-proto
Expand All @@ -18,11 +27,3 @@ protobuf_generate(
skin.proto
waveform.proto
)

if(TARGET protobuf::libprotobuf-lite)
target_link_libraries(mixxx-proto PRIVATE protobuf::libprotobuf-lite)
elseif(TARGET protobuf::libprotobuf)
target_link_libraries(mixxx-proto PRIVATE protobuf::libprotobuf)
else()
message(FATAL_ERROR "Protobuf or Protobuf-lite libraries are required to compile Mixxx.")
endif()

0 comments on commit b4cae36

Please sign in to comment.