Findlibjxl.cmake 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # SDL_image: An example image loading library for use with SDL
  2. # Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
  3. #
  4. # This software is provided 'as-is', without any express or implied
  5. # warranty. In no event will the authors be held liable for any damages
  6. # arising from the use of this software.
  7. #
  8. # Permission is granted to anyone to use this software for any purpose,
  9. # including commercial applications, and to alter it and redistribute it
  10. # freely, subject to the following restrictions:
  11. #
  12. # 1. The origin of this software must not be misrepresented; you must not
  13. # claim that you wrote the original software. If you use this software
  14. # in a product, an acknowledgment in the product documentation would be
  15. # appreciated but is not required.
  16. # 2. Altered source versions must be plainly marked as such, and must not be
  17. # misrepresented as being the original software.
  18. # 3. This notice may not be removed or altered from any source distribution.
  19. include(FindPackageHandleStandardArgs)
  20. find_library(libjxl_LIBRARY
  21. NAMES jxl
  22. )
  23. find_path(libjxl_INCLUDE_PATH
  24. NAMES jxl/decode.h
  25. )
  26. set(libjxl_COMPILE_OPTIONS "" CACHE STRING "Extra compile options of libjxl")
  27. set(libjxl_LINK_LIBRARIES "" CACHE STRING "Extra link libraries of libjxl")
  28. set(libjxl_LINK_FLAGS "" CACHE STRING "Extra link flags of libjxl")
  29. find_package_handle_standard_args(libjxl
  30. REQUIRED_VARS libjxl_LIBRARY libjxl_INCLUDE_PATH
  31. )
  32. if (libjxl_FOUND)
  33. if (NOT TARGET libjxl::libjxl)
  34. add_library(libjxl::libjxl UNKNOWN IMPORTED)
  35. set_target_properties(libjxl::libjxl PROPERTIES
  36. IMPORTED_LOCATION "${libjxl_LIBRARY}"
  37. INTERFACE_INCLUDE_DIRECTORIES "${libjxl_INCLUDE_PATH}"
  38. INTERFACE_COMPILE_OPTIONS "${libjxl_COMPILE_OPTIONS}"
  39. INTERFACE_LINK_LIBRARIES "${libjxl_LINK_LIBRARIES}"
  40. INTERFACE_LINK_FLAGS "${libjxl_LINK_FLAGS}"
  41. )
  42. endif()
  43. endif()