CMakeLists.txt 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. zxing_add_package_stb()
  2. include (GNUInstallDirs)
  3. if (ZXING_WRITERS)
  4. add_executable (ZXingWriter ZXingWriter.cpp)
  5. target_link_libraries (ZXingWriter ZXing::ZXing stb::stb)
  6. add_test(NAME ZXingWriterTest COMMAND ZXingWriter qrcode "I have the best words." test.png)
  7. install(TARGETS ZXingWriter DESTINATION ${CMAKE_INSTALL_BINDIR})
  8. endif()
  9. if (ZXING_READERS)
  10. add_executable (ZXingReader ZXingReader.cpp)
  11. target_link_libraries (ZXingReader ZXing::ZXing stb::stb)
  12. add_test(NAME ZXingReaderTest COMMAND ZXingReader -fast -format qrcode test.png) # see above
  13. install(TARGETS ZXingReader DESTINATION ${CMAKE_INSTALL_BINDIR})
  14. endif()
  15. find_package(Qt6 COMPONENTS Gui Multimedia Quick QUIET)
  16. if (NOT (Qt5_FOUND OR Qt6_FOUND))
  17. message("INFO: Qt (Gui/Multimedia/Quick) not found, skipping Qt examples")
  18. endif()
  19. set(CMAKE_AUTOMOC ON)
  20. set(CMAKE_AUTORCC ON)
  21. if (ZXING_READERS)
  22. if (TARGET Qt::Gui)
  23. add_executable (ZXingQtReader ZXingQtReader.cpp ZXingQtReader.h)
  24. target_link_libraries(ZXingQtReader ZXing::ZXing Qt::Gui)
  25. endif()
  26. if (TARGET Qt::Multimedia AND TARGET Qt::Quick)
  27. add_executable(ZXingQtCamReader ZXingQtCamReader.cpp ZXingQtCamReader.qrc ZXingQtReader.h)
  28. target_link_libraries(ZXingQtCamReader ZXing::ZXing Qt::Gui Qt::Multimedia Qt::Quick)
  29. endif()
  30. find_package(OpenCV QUIET)
  31. if (OpenCV_FOUND)
  32. add_executable (ZXingOpenCV ZXingOpenCV.cpp)
  33. target_include_directories (ZXingOpenCV PRIVATE ${OpenCV_INCLUDE_DIRS})
  34. target_link_libraries (ZXingOpenCV ZXing::ZXing ${OpenCV_LIBS})
  35. else ()
  36. message("INFO: OpenCV not found, skipping ZXingOpenCV example")
  37. endif()
  38. endif()
  39. if (ZXING_WRITERS)
  40. if (TARGET Qt::Gui)
  41. add_executable (ZXingQtWriter ZXingQtWriter.cpp)
  42. target_link_libraries(ZXingQtWriter ZXing::ZXing Qt::Gui)
  43. endif()
  44. endif()