Skip to content

Commit 8671e50

Browse files
committed
Avoid big-scary cmake warning for optional libs
As the libs are optional, lets avoid the big CMake warning when the opencv library or Qt is not found. It mostly has info for the maintainers, not for people building this. Instead add a one line message stating the cause and effect.
1 parent f323f1e commit 8671e50

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

example/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ if (BUILD_READERS)
2323
endif()
2424

2525
if (BUILD_READERS)
26-
find_package(Qt5 COMPONENTS Gui Multimedia Quick)
26+
find_package(Qt5 COMPONENTS Gui Multimedia Quick QUIET)
27+
if (NOT (Qt5_FOUND OR Qt6_FOUND))
28+
message("INFO: Qt (Gui/Multimedia/Quick) not found, skipping Qt examples")
29+
endif()
30+
2731
set(CMAKE_AUTOMOC ON)
2832
set(CMAKE_AUTORCC ON)
2933

@@ -37,10 +41,12 @@ if (BUILD_READERS)
3741
target_link_libraries(ZXingQtCamReader ZXing::ZXing Qt::Gui Qt::Multimedia Qt::Quick)
3842
endif()
3943

40-
find_package(OpenCV)
44+
find_package(OpenCV QUIET)
4145
if (OpenCV_FOUND)
4246
add_executable (ZXingOpenCV ZXingOpenCV.cpp)
4347
target_include_directories (ZXingOpenCV PRIVATE ${OpenCV_INCLUDE_DIRS})
4448
target_link_libraries (ZXingOpenCV ZXing::ZXing ${OpenCV_LIBS})
49+
else ()
50+
message("INFO: OpenCV not found, skipping ZXingOpenCV example")
4551
endif()
4652
endif()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy