<commit_before>cmake_minimum_required(VERSION 2.8.11)

project(MediaInfoLib)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules")

set(MediaInfoLib_MAJOR_VERSION 21)
set(MediaInfoLib_MINOR_VERSION 09)
set(MediaInfoLib_PATCH_VERSION 0)
set(MediaInfoLib_VERSION ${MediaInfoLib_MAJOR_VERSION}.${MediaInfoLib_MINOR_VERSION})

if (MediaInfoLib_PATCH_VERSION)
  set(MediaInfoLib_VERSION ${MediaInfoLib_VERSION}.${MediaInfoLib_PATCH_VERSION})
endif()

set(MediaInfoLib_SOVERSION 0)

if (NOT WIN32)
  option(BUILD_ZLIB "Build bundled zlib" OFF)
  option(BUILD_ZENLIB "Build bundled ZenLib" OFF)
else()
  option(BUILD_ZLIB "Build bundled zlib" ON)
  option(BUILD_ZENLIB "Build bundled ZenLib" ON)
endif()

set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE STRING "Directory where binary will install")
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Directory where library will install")
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")

configure_file(
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
  IMMEDIATE @ONLY)

if(NOT TARGET uninstall)
    add_custom_target(uninstall
   "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
endif()

if (NOT BUILD_ZENLIB)
  find_package(ZenLib REQUIRED)
else()
  set(_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
  set(BUILD_SHARED_LIBS OFF)
  add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../ZenLib/Project/CMake ${CMAKE_CURRENT_BINARY_DIR}/ZenLib)
  set(BUILD_SHARED_LIBS ${_BUILD_SHARED_LIBS})
  set(ZenLib_LIBRARY zen)
  unset(_BUILD_SHARED_LIBS)
  if(UNIX AND BUILD_SHARED_LIBS)
    target_compile_options(zen PRIVATE -fPIC)
  endif()
endif()

if (NOT BUILD_ZLIB)
  find_package(ZLIB REQUIRED)
else()
  add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib)
  get_target_property(ZLIB_LIBRARIES zlibstatic LOCATION)
  if(NOT BUILD_SHARED_LIBS)
    get_filename_component(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} NAME)
    set(ZLIB_LIBRARIES "${LIB_INSTALL_DIR}/${ZLIB_LIBRARIES}")
  endif()
  if(UNIX AND BUILD_SHARED_LIBS)
    target_compile_options(zlibstatic PRIVATE -fPIC)
  endif()
  set(ZLIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../../../zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib)
endif()

if(VCPKG_TARGET_TRIPLET)
  set(MediaInfoLib_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/mediainfolib")
elseif(MSVC)
  set(MediaInfoLib_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/cmake")
else()
  set(MediaInfoLib_CONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake/mediainfolib")
endif()

set(MediaInfoLib_SOURCES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../Source)

# On Windows debug library should have 'd' postfix.
if(WIN32)
  set(CMAKE_DEBUG_POSTFIX "d")
elseif(APPLE)
  set(CMAKE_DEBUG_POSTFIX "_debug")
endif()

# use bundled tinyxml only if no system
find_package(TinyXML)

# use system curl if is present
find_package(CURL)

include_directories(${MediaInfoLib_SOURCES_PATH})
include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/md5/)
include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/base64/)
include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/aes-gladman/)
include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/sha1-gladman/)
include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/sha2-gladman/)
include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/hmac-gladman/)
include_directories(${ZLIB_INCLUDE_DIRS})

set(MediaInfoLib_PUBLIC_HDRS
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo.h
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfoList.h
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Const.h
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Events.h
  ${MediaInfoLib_SOURCES_PATH}/MediaInfoDLL/MediaInfoDLL.h
  ${MediaInfoLib_SOURCES_PATH}/MediaInfoDLL/MediaInfoDLL_Static.h
)

set(MediaInfoLib_SRCS
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/md5/md5.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/aes-gladman/aes_modes.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/aes-gladman/aescrypt.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/aes-gladman/aeskey.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/aes-gladman/aestab.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/sha1-gladman/sha1.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/sha2-gladman/sha2.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/hmac-gladman/hmac.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/tfsxml/tfsxml.c
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Analyze.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Analyze_Buffer.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Analyze_Buffer_MinimizeSize.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Analyze_Element.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Analyze_Streams.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Analyze_Streams_Finish.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Base.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__MultipleParsing.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Duplicate.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__HasReferences.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File_Dummy.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File_Other.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File_Unknown.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/HashWrapper.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Config.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Config_Automatic.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Config_MediaInfo.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Config_PerPackage.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_File.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Inform.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Internal.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfoList.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfoList_Internal.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/TimeCode.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_7z.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Ace.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Bzip2.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Elf.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Gzip.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Iso9660.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Mz.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Rar.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Tar.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Zip.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Aac.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Aac_GeneralAudio.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Aac_GeneralAudio_Sbr.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Aac_GeneralAudio_Sbr_Ps.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Aac_Main.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Aac_Others.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Ac3.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Ac4.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Adm.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Adpcm.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Als.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Amr.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Amv.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Ape.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Au.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Caf.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Celt.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_ChannelGrouping.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_ChannelSplitting.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Dsdiff.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Dsf.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Dts.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_DolbyAudioMetadata.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_DolbyE.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_ExtendedModule.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Flac.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Iab.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_ImpulseTracker.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_La.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Midi.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Module.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Mpc.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_MpcSv8.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Mpega.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Mpegh3da.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_OpenMG.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Opus.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Pcm.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Pcm_M2ts.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Pcm_Vob.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Ps2Audio.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Rkau.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_ScreamTracker3.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_SmpteSt0302.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_SmpteSt0337.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_SmpteSt0331.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Speex.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Tak.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Tta.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_TwinVQ.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Usac.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Vorbis.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Wvpk.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Duplicate/File__Duplicate__Base.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Duplicate/File__Duplicate__Writer.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Duplicate/File__Duplicate_MpegTs.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_EbuCore.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_Niso.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_Graph.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_Fims.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_Mpeg7.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_PBCore.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_PBCore2.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_reVTMD.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_ArriRaw.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Bmp.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Bpg.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Dds.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Dpx.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Exr.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Gif.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Ico.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Jpeg.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Pcx.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Png.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Psd.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Rle.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Tiff.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Tga.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File__ReferenceFilesHelper.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File__ReferenceFilesHelper_Resource.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File__ReferenceFilesHelper_Sequence.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Aaf.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Ancillary.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Bdmv.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Cdxa.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_DashMpd.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_DcpAm.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_DcpCpl.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_DcpPkl.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Dpg.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_DvDif.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_DvDif_Analysis.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Dvdv.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Dxw.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Flv.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Gxf.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_HdsF4m.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Hls.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Gxf.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Gxf_TimeCode.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Ibi.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Ibi_Creation.cpp<commit_msg>Replace duplicate file entry<commit_after>cmake_minimum_required(VERSION 2.8.11)

project(MediaInfoLib)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules")

set(MediaInfoLib_MAJOR_VERSION 21)
set(MediaInfoLib_MINOR_VERSION 09)
set(MediaInfoLib_PATCH_VERSION 0)
set(MediaInfoLib_VERSION ${MediaInfoLib_MAJOR_VERSION}.${MediaInfoLib_MINOR_VERSION})

if (MediaInfoLib_PATCH_VERSION)
  set(MediaInfoLib_VERSION ${MediaInfoLib_VERSION}.${MediaInfoLib_PATCH_VERSION})
endif()

set(MediaInfoLib_SOVERSION 0)

if (NOT WIN32)
  option(BUILD_ZLIB "Build bundled zlib" OFF)
  option(BUILD_ZENLIB "Build bundled ZenLib" OFF)
else()
  option(BUILD_ZLIB "Build bundled zlib" ON)
  option(BUILD_ZENLIB "Build bundled ZenLib" ON)
endif()

set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE STRING "Directory where binary will install")
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Directory where library will install")
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")

configure_file(
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
  IMMEDIATE @ONLY)

if(NOT TARGET uninstall)
    add_custom_target(uninstall
   "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
endif()

if (NOT BUILD_ZENLIB)
  find_package(ZenLib REQUIRED)
else()
  set(_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
  set(BUILD_SHARED_LIBS OFF)
  add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../ZenLib/Project/CMake ${CMAKE_CURRENT_BINARY_DIR}/ZenLib)
  set(BUILD_SHARED_LIBS ${_BUILD_SHARED_LIBS})
  set(ZenLib_LIBRARY zen)
  unset(_BUILD_SHARED_LIBS)
  if(UNIX AND BUILD_SHARED_LIBS)
    target_compile_options(zen PRIVATE -fPIC)
  endif()
endif()

if (NOT BUILD_ZLIB)
  find_package(ZLIB REQUIRED)
else()
  add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib)
  get_target_property(ZLIB_LIBRARIES zlibstatic LOCATION)
  if(NOT BUILD_SHARED_LIBS)
    get_filename_component(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} NAME)
    set(ZLIB_LIBRARIES "${LIB_INSTALL_DIR}/${ZLIB_LIBRARIES}")
  endif()
  if(UNIX AND BUILD_SHARED_LIBS)
    target_compile_options(zlibstatic PRIVATE -fPIC)
  endif()
  set(ZLIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../../../zlib ${CMAKE_CURRENT_BINARY_DIR}/zlib)
endif()

if(VCPKG_TARGET_TRIPLET)
  set(MediaInfoLib_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/mediainfolib")
elseif(MSVC)
  set(MediaInfoLib_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/cmake")
else()
  set(MediaInfoLib_CONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake/mediainfolib")
endif()

set(MediaInfoLib_SOURCES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../Source)

# On Windows debug library should have 'd' postfix.
if(WIN32)
  set(CMAKE_DEBUG_POSTFIX "d")
elseif(APPLE)
  set(CMAKE_DEBUG_POSTFIX "_debug")
endif()

# use bundled tinyxml only if no system
find_package(TinyXML)

# use system curl if is present
find_package(CURL)

include_directories(${MediaInfoLib_SOURCES_PATH})
include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/md5/)
include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/base64/)
include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/aes-gladman/)
include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/sha1-gladman/)
include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/sha2-gladman/)
include_directories(${MediaInfoLib_SOURCES_PATH}/ThirdParty/hmac-gladman/)
include_directories(${ZLIB_INCLUDE_DIRS})

set(MediaInfoLib_PUBLIC_HDRS
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo.h
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfoList.h
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Const.h
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Events.h
  ${MediaInfoLib_SOURCES_PATH}/MediaInfoDLL/MediaInfoDLL.h
  ${MediaInfoLib_SOURCES_PATH}/MediaInfoDLL/MediaInfoDLL_Static.h
)

set(MediaInfoLib_SRCS
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/md5/md5.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/aes-gladman/aes_modes.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/aes-gladman/aescrypt.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/aes-gladman/aeskey.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/aes-gladman/aestab.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/sha1-gladman/sha1.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/sha2-gladman/sha2.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/hmac-gladman/hmac.c
  ${MediaInfoLib_SOURCES_PATH}/ThirdParty/tfsxml/tfsxml.c
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Analyze.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Analyze_Buffer.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Analyze_Buffer_MinimizeSize.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Analyze_Element.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Analyze_Streams.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Analyze_Streams_Finish.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Base.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__MultipleParsing.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__Duplicate.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File__HasReferences.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File_Dummy.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File_Other.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/File_Unknown.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/HashWrapper.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Config.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Config_Automatic.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Config_MediaInfo.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Config_PerPackage.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_File.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Inform.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfo_Internal.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfoList.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/MediaInfoList_Internal.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/TimeCode.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_7z.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Ace.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Bzip2.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Elf.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Gzip.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Iso9660.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Mz.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Rar.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Tar.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Archive/File_Zip.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Aac.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Aac_GeneralAudio.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Aac_GeneralAudio_Sbr.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Aac_GeneralAudio_Sbr_Ps.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Aac_Main.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Aac_Others.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Ac3.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Ac4.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Adm.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Adpcm.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Als.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Amr.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Amv.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Ape.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Au.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Caf.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Celt.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_ChannelGrouping.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_ChannelSplitting.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Dsdiff.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Dsf.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Dts.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_DolbyAudioMetadata.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_DolbyE.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_ExtendedModule.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Flac.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Iab.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_ImpulseTracker.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_La.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Midi.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Module.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Mpc.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_MpcSv8.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Mpega.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Mpegh3da.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_OpenMG.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Opus.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Pcm.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Pcm_M2ts.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Pcm_Vob.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Ps2Audio.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Rkau.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_ScreamTracker3.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_SmpteSt0302.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_SmpteSt0337.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_SmpteSt0331.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Speex.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Tak.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Tta.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_TwinVQ.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Usac.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Vorbis.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Audio/File_Wvpk.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Duplicate/File__Duplicate__Base.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Duplicate/File__Duplicate__Writer.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Duplicate/File__Duplicate_MpegTs.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_EbuCore.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_Niso.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_Graph.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_Fims.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_Mpeg7.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_PBCore.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_PBCore2.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Export/Export_reVTMD.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_ArriRaw.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Bmp.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Bpg.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Dds.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Dpx.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Exr.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Gif.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Ico.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Jpeg.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Pcx.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Png.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Psd.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Rle.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Tiff.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Image/File_Tga.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File__ReferenceFilesHelper.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File__ReferenceFilesHelper_Resource.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File__ReferenceFilesHelper_Sequence.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Aaf.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Ancillary.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Bdmv.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Cdxa.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_DashMpd.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_DcpAm.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_DcpCpl.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_DcpPkl.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Dpg.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_DvDif.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_DvDif_Analysis.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Dvdv.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Dxw.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Flv.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Gxf.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Gxf_TimeCode.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_HdsF4m.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Hls.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Ibi.cpp
  ${MediaInfoLib_SOURCES_PATH}/MediaInfo/Multiple/File_Ibi_Creation.cpp
{'fraction_non_alphanumeric': 0.10806895014488446, 'fraction_numerical': 0.004235084330187979, 'mean_word_length': 8.298445595854922, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6172864', 'n_tokens_mistral': 10833, 'n_tokens_neox': 9916, 'n_words': 715}