FindTurboJPEG.cmake 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # FindTurboJPEG.cmake
  2. # TURBOJPEG_FOUND
  3. # TurboJPEG_INCLUDE_DIRS
  4. # TurboJPEG_LIBRARY
  5. if (ENABLE_MF)
  6. find_path(TurboJPEG_INCLUDE_DIRS
  7. NAMES turbojpeg.h
  8. PATHS
  9. "C:/libjpeg-turbo64"
  10. PATH_SUFFIXES include
  11. )
  12. find_library(TurboJPEG_LIBRARY
  13. NAMES turbojpeg turbojpeg-static
  14. PATHS
  15. "C:/libjpeg-turbo64"
  16. PATH_SUFFIXES bin lib
  17. )
  18. else()
  19. find_path(TurboJPEG_INCLUDE_DIRS
  20. NAMES turbojpeg.h
  21. PATH_SUFFIXES include
  22. )
  23. find_library(TurboJPEG_LIBRARY
  24. NAMES turbojpeg turbojpeg-static
  25. PATH_SUFFIXES bin lib
  26. )
  27. endif()
  28. if(TurboJPEG_INCLUDE_DIRS AND TurboJPEG_LIBRARY)
  29. include(CheckCSourceCompiles)
  30. include(CMakePushCheckState)
  31. cmake_push_check_state(RESET)
  32. list(APPEND CMAKE_REQUIRED_INCLUDES ${TurboJPEG_INCLUDE_DIRS})
  33. list(APPEND CMAKE_REQUIRED_LIBRARIES ${TurboJPEG_LIBRARY})
  34. check_c_source_compiles("#include <turbojpeg.h>\nint main(void) { tjhandle h=tjInitCompress(); return 0; }" TURBOJPEG_WORKS)
  35. cmake_pop_check_state()
  36. endif()
  37. include(FindPackageHandleStandardArgs)
  38. find_package_handle_standard_args(TurboJPEG
  39. FOUND_VAR TURBOJPEG_FOUND
  40. REQUIRED_VARS TurboJPEG_LIBRARY TurboJPEG_INCLUDE_DIRS TURBOJPEG_WORKS
  41. TurboJPEG_INCLUDE_DIRS TurboJPEG_LIBRARY
  42. )