set(EXTRA_LIBS)
if(APPLE)
    set(EXTRA_LIBS ${EXTRA_LIBS} -lz)
endif()
if(UNIX)
    set(EXTRA_LIBS ${EXTRA_LIBS} -lpthread)
endif()

set(CMAKE_REQUIRED_LIBRARIES
	${FFMPEG_LIBAVFORMAT_LIBRARIES}
	${FFMPEG_LIBAVCODEC_LIBRARIES}
	${FFMPEG_LIBAVUTIL_LIBRARIES}
	${EXTRA_LIBS})

include_directories(
	${CMAKE_CURRENT_SOURCE_DIR}/../src
	${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}
	${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}
	${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}
)

add_executable(fpcalc fpcalc.c)

target_link_libraries(fpcalc chromaprint
	${FFMPEG_LIBAVFORMAT_LIBRARIES}
	${FFMPEG_LIBAVCODEC_LIBRARIES}
	${FFMPEG_LIBAVUTIL_LIBRARIES}
	${EXTRA_LIBS})

if(FFMPEG_LIBSWRESAMPLE_LIBRARIES)
	add_definitions(-DHAVE_SWRESAMPLE)
	include_directories(${FFMPEG_LIBSWRESAMPLE_INCLUDE_DIRS})
	target_link_libraries(fpcalc ${FFMPEG_LIBSWRESAMPLE_LIBRARIES})
endif()

install(TARGETS fpcalc
	RUNTIME DESTINATION ${BIN_INSTALL_DIR}
)


set(EXTRA_LIBS)
if(APPLE)
    set(EXTRA_LIBS ${EXTRA_LIBS} -lz)
endif()
if(UNIX)
    set(EXTRA_LIBS ${EXTRA_LIBS} -lpthread)
endif()

set(CMAKE_REQUIRED_LIBRARIES
	${FFMPEG_LIBAVFORMAT_LIBRARIES}
	${FFMPEG_LIBAVCODEC_LIBRARIES}
	${FFMPEG_LIBAVUTIL_LIBRARIES}
	${EXTRA_LIBS})

include_directories(
	${CMAKE_CURRENT_SOURCE_DIR}/../src
	${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}
	${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}
	${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}
)

add_executable(fpcalc fpcalc.c)

target_link_libraries(fpcalc chromaprint
	${FFMPEG_LIBAVFORMAT_LIBRARIES}
	${FFMPEG_LIBAVCODEC_LIBRARIES}
	${FFMPEG_LIBAVUTIL_LIBRARIES}
	${EXTRA_LIBS})

if(FFMPEG_LIBSWRESAMPLE_FOUND)
	add_definitions(-DHAVE_SWRESAMPLE)
	include_directories(${FFMPEG_LIBSWRESAMPLE_INCLUDE_DIRS})
	target_link_libraries(fpcalc ${FFMPEG_LIBSWRESAMPLE_LIBRARIES})
endif()

install(TARGETS fpcalc
	RUNTIME DESTINATION ${BIN_INSTALL_DIR}
)


Use FFMPEG_LIBSWRESAMPLE_FOUND to check if we have found libswresample (it checks both libraries and include dirs)
Use FFMPEG_LIBSWRESAMPLE_FOUND to check if we have found libswresample (it checks both libraries and include dirs)
