windows-amd64-prebuilt-libr.../vcpkg/ports/simage/link-flac-library.patch
2020-10-10 14:36:42 +02:00

61 lines
1.5 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 775037a..2de9b9f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -108,6 +108,10 @@ find_package(Jasper)
find_package(OggVorbis)
find_package(Sndfile)
+if(SNDFILE_FOUND)
+ find_package(FLAC)
+endif()
+
if(APPLE AND SIMAGE_USE_CGIMAGE)
check_cxx_source_compiles("
#include <CoreFoundation/CoreFoundation.h>
@@ -467,6 +471,9 @@ endif()
if(SNDFILE_FOUND)
target_include_directories(simage PRIVATE ${SNDFILE_INCLUDE_DIRS})
target_link_libraries(simage PRIVATE ${SNDFILE_LIBRARIES})
+ if(FLAC_FOUND)
+ target_link_libraries(simage PRIVATE ${FLAC_LIBRARIES})
+ endif()
endif()
if(TIFF_FOUND)
diff --git a/FindFLAC.cmake b/FindFLAC.cmake
new file mode 100644
index 0000000..ce40a11
--- /dev/null
+++ b/FindFLAC.cmake
@@ -0,0 +1,29 @@
+include(FindPackageHandleStandardArgs)
+
+find_path(FLAC_INCLUDE_DIR FLAC/all.h)
+
+mark_as_advanced(FLAC_INCLUDE_DIR)
+
+set(FLAC_INCLUDE_DIRS ${FLAC_INCLUDE_DIR})
+
+find_library(FLAC_LIBRARY NAMES FLAC)
+
+mark_as_advanced(
+ FLAC_INCLUDE_DIR
+ FLAC_LIBRARY
+)
+
+set(FLAC_LIBRARIES ${FLAC_LIBRARY})
+
+find_package_handle_standard_args(
+ FLAC
+ DEFAULT_MSG
+ FLAC_INCLUDE_DIRS
+ FLAC_LIBRARIES
+)
+
+if(FLAC_FOUND AND NOT TARGET FLAC::FLAC)
+ add_library(FLAC::FLAC UNKNOWN IMPORTED)
+ set_target_properties(FLAC::FLAC PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_DIR}")
+ set_property(TARGET FLAC::FLAC APPEND PROPERTY IMPORTED_LOCATION "${FLAC_LIBRARY}")
+endif()