unofficial-libvpx-config.cmake.in 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. if(NOT TARGET unofficial::libvpx::libvpx)
  2. # Compute the installation prefix relative to this file.
  3. get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
  4. get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
  5. get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
  6. # Add library target (note: vpx always has a static build in vcpkg).
  7. add_library(unofficial::libvpx::libvpx STATIC IMPORTED)
  8. # Add interface include directories and link interface languages (applies to all configurations).
  9. set_target_properties(unofficial::libvpx::libvpx PROPERTIES
  10. INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  11. IMPORTED_LINK_INTERFACE_LANGUAGES "C"
  12. )
  13. list(APPEND _IMPORT_CHECK_FILES "${_IMPORT_PREFIX}/include/vpx/vpx_codec.h")
  14. # Add release configuration properties.
  15. find_library(_LIBFILE_RELEASE NAMES vpx PATHS "${_IMPORT_PREFIX}/lib/" NO_DEFAULT_PATH)
  16. set_property(TARGET unofficial::libvpx::libvpx
  17. APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
  18. set_target_properties(unofficial::libvpx::libvpx PROPERTIES
  19. IMPORTED_LOCATION_RELEASE ${_LIBFILE_RELEASE})
  20. list(APPEND _IMPORT_CHECK_FILES ${_LIBFILE_RELEASE})
  21. unset(_LIBFILE_RELEASE CACHE)
  22. # Add debug configuration properties.
  23. if(@LIBVPX_CONFIG_DEBUG@)
  24. find_library(_LIBFILE_DEBUG NAMES vpx PATHS "${_IMPORT_PREFIX}/debug/lib/" NO_DEFAULT_PATH)
  25. set_property(TARGET unofficial::libvpx::libvpx
  26. APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
  27. set_target_properties(unofficial::libvpx::libvpx PROPERTIES
  28. IMPORTED_LOCATION_DEBUG ${_LIBFILE_DEBUG})
  29. list(APPEND _IMPORT_CHECK_FILES ${_LIBFILE_DEBUG})
  30. unset(_LIBFILE_DEBUG CACHE)
  31. endif()
  32. # Check header and library files are present.
  33. foreach(file ${_IMPORT_CHECK_FILES} )
  34. if(NOT EXISTS "${file}" )
  35. message(FATAL_ERROR "unofficial::libvpx::libvpx references the file
  36. \"${file}\"
  37. but this file does not exist. Possible reasons include:
  38. * The file was deleted, renamed, or moved to another location.
  39. * An install or uninstall procedure did not complete successfully.
  40. ")
  41. endif()
  42. endforeach()
  43. unset(_IMPORT_CHECK_FILES)
  44. endif()