Make FLAC support optional

--- src/plugins/oggflacmetadata/CMakeLists.txt.orig	2019-08-23 09:52:05 UTC
+++ src/plugins/oggflacmetadata/CMakeLists.txt
@@ -1,8 +1,12 @@
-if(WITH_VORBIS)
+if(WITH_VORBIS OR WITH_FLAC)
   set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
 
-  find_package(Vorbis REQUIRED)
-  find_package(FLAC)
+  if(WITH_VORBIS)
+    find_package(Vorbis REQUIRED)
+  endif()
+  if(WITH_FLAC)
+    find_package(FLAC REQUIRED)
+  endif()
 
   configure_file(oggflacconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/oggflacconfig.h)
 
@@ -28,7 +32,13 @@ if(WITH_VORBIS)
 
   target_include_directories(${plugin_TARGET} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
 
-  target_link_libraries(${plugin_TARGET} kid3-core VorbisFile::VorbisFile FLACPP::FLACPP Kid3Plugin)
+  target_link_libraries(${plugin_TARGET} kid3-core Kid3Plugin)
+  if(HAVE_VORBIS)
+    target_link_libraries(${plugin_TARGET} VorbisFile::VorbisFile)
+  endif()
+  if(HAVE_FLAC)
+    target_link_libraries(${plugin_TARGET} FLACPP::FLACPP)
+  endif()
 
   target_compile_definitions(${plugin_TARGET} PRIVATE HAVE_CONFIG_H)
 
