FindImageMagick Components should complain about missing pkg-config
Summary
If an installation has no pkg-config, cmake tells that api component is not found.
Steps to reproduce
- Install
ImageMagick-7
- Install
cmake 3.23.1
- Remove
pkg-config
, if present
In your CMakeLists.txt
run:
find_package(ImageMagick 7.0.0 REQUIRED)
find_package(ImageMagick COMPONENTS Magick++ REQUIRED)
What is the current bug behavior?
- First line
find_package(ImageMagick 7.0.0 REQUIRED)
does not pop up an error - Second line
find_package(ImageMagick COMPONENTS Magick++ REQUIRED)
fails
It does not tell that it cannot find without pkg-config
installed.
What is the expected correct behavior?
It should tell, that find is unsuccessful because missing pkg-config
.
Relevant logs and/or screenshots
cmake ..
brings:
[cmake] -- Found ImageMagick: /usr/local/bin/convert (found suitable version "7.1.0-34", minimum required is "7.0.0")
[cmake] CMake Error at /snap/cmake/1082/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
[cmake] Could NOT find ImageMagick (missing: ImageMagick_Magick++_LIBRARY) (found
[cmake] version "7.1.0-34")
cmake --debug-find ..
brings:
Long log
Call Stack (most recent call first): /snap/cmake/1082/share/cmake-3.23/Modules/FindImageMagick.cmake:90 (find_package) CMakeLists.txt:103 (find_package)CMake Debug Log at /snap/cmake/1082/share/cmake-3.23/Modules/FindImageMagick.cmake:90 (find_package): find_package considered the following paths for FindPkgConfig.cmake:
/home/fins/development/tqswip/printer/cmake/FindPkgConfig.cmake
The file was found at
/snap/cmake/1082/share/cmake-3.23/Modules/FindPkgConfig.cmake
The module is considered not found due to PkgConfig_FOUND being FALSE. Call Stack (most recent call first): CMakeLists.txt:103 (find_package)
CMake Debug Log at CMakeLists.txt:103 (find_package): find_package considered the following paths for FindImageMagick.cmake:
/home/fins/development/tqswip/printer/cmake/FindImageMagick.cmake
The file was found at
/snap/cmake/1082/share/cmake-3.23/Modules/FindImageMagick.cmake
CMake Debug Log at /snap/cmake/1082/share/cmake-3.23/Modules/FindPkgConfig.cmake:62 (find_program): find_program called with the following settings:
VAR: PKG_CONFIG_EXECUTABLE NAMES: "pkg-config" "pkgconf" Documentation: pkg-config executable Framework Only Search Frameworks: 0 Search Frameworks Last: 0 Search Frameworks First: 0 AppBundle Only Search AppBundle: 0 Search AppBundle Last: 0 Search AppBundle First: 0 CMAKE_FIND_USE_CMAKE_PATH: 1 CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1 CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1 CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
find_program considered the following locations:
/usr/local/sbin/pkg-config /usr/local/sbin/pkgconf /usr/local/bin/pkg-config /usr/local/bin/pkgconf /usr/sbin/pkg-config /usr/sbin/pkgconf /usr/bin/pkg-config /usr/bin/pkgconf /sbin/pkg-config /sbin/pkgconf /bin/pkg-config /bin/pkgconf /usr/games/pkg-config /usr/games/pkgconf /usr/local/games/pkg-config /usr/local/games/pkgconf /snap/bin/pkg-config /snap/bin/pkgconf /usr/local/bin/pkg-config /usr/local/bin/pkgconf /usr/local/sbin/pkg-config /usr/local/sbin/pkgconf /usr/local/pkg-config /usr/local/pkgconf /usr/bin/pkg-config /usr/bin/pkgconf /usr/sbin/pkg-config /usr/sbin/pkgconf /usr/pkg-config /usr/pkgconf /bin/pkg-config /bin/pkgconf /sbin/pkg-config /sbin/pkgconf /snap/cmake/1082/bin/pkg-config /snap/cmake/1082/bin/pkgconf /snap/cmake/1082/sbin/pkg-config /snap/cmake/1082/sbin/pkgconf /snap/cmake/1082/pkg-config /snap/cmake/1082/pkgconf /home/fins/development/tmp/bin/pkg-config /home/fins/development/tmp/bin/pkgconf /home/fins/development/tmp/sbin/pkg-config /home/fins/development/tmp/sbin/pkgconf /home/fins/development/tmp/pkg-config /home/fins/development/tmp/pkgconf /usr/X11R6/bin/pkg-config /usr/X11R6/bin/pkgconf /usr/X11R6/sbin/pkg-config /usr/X11R6/sbin/pkgconf /usr/X11R6/pkg-config /usr/X11R6/pkgconf /usr/pkg/bin/pkg-config /usr/pkg/bin/pkgconf /usr/pkg/sbin/pkg-config /usr/pkg/sbin/pkgconf /usr/pkg/pkg-config /usr/pkg/pkgconf /opt/bin/pkg-config /opt/bin/pkgconf /opt/sbin/pkg-config /opt/sbin/pkgconf /opt/pkg-config /opt/pkgconf
The item was not found.
Call Stack (most recent call first): /snap/cmake/1082/share/cmake-3.23/Modules/FindImageMagick.cmake:90 (find_package) CMakeLists.txt:105 (find_package)
CMake Debug Log at /snap/cmake/1082/share/cmake-3.23/Modules/FindImageMagick.cmake:90 (find_package): find_package considered the following paths for FindPkgConfig.cmake:
/home/fins/development/tqswip/printer/cmake/FindPkgConfig.cmake
The file was found at
/snap/cmake/1082/share/cmake-3.23/Modules/FindPkgConfig.cmake
The module is considered not found due to PkgConfig_FOUND being FALSE. Call Stack (most recent call first): CMakeLists.txt:105 (find_package)
CMake Debug Log at /snap/cmake/1082/share/cmake-3.23/Modules/FindImageMagick.cmake:100 (find_path): find_path called with the following settings:
VAR: ImageMagick_Magick++_INCLUDE_DIR NAMES: "Magick++.h" Documentation: Path to the ImageMagick arch-independent include dir. Framework Only Search Frameworks: 0 Search Frameworks Last: 0 Search Frameworks First: 0 AppBundle Only Search AppBundle: 0 Search AppBundle Last: 0 Search AppBundle First: 0 NO_DEFAULT_PATH Enabled
find_path considered the following locations:
/registry/include/ImageMagick/Magick++.h /registry/include/ImageMagick-6/Magick++.h /registry/include/ImageMagick-7/Magick++.h /registry/include/Magick++.h
The item was not found.
Call Stack (most recent call first): /snap/cmake/1082/share/cmake-3.23/Modules/FindImageMagick.cmake:204 (FIND_IMAGEMAGICK_API) CMakeLists.txt:105 (find_package)
CMake Debug Log at /snap/cmake/1082/share/cmake-3.23/Modules/FindImageMagick.cmake:113 (find_path): find_path called with the following settings:
VAR: ImageMagick_Magick++_ARCH_INCLUDE_DIR NAMES: "magick/magick-baseconfig.h" Documentation: Path to the ImageMagick arch-specific include dir. Framework Only Search Frameworks: 0 Search Frameworks Last: 0 Search Frameworks First: 0 AppBundle Only Search AppBundle: 0 Search AppBundle Last: 0 Search AppBundle First: 0 NO_DEFAULT_PATH Enabled
find_path considered the following locations:
/registry/include/ImageMagick/magick/magick-baseconfig.h /registry/include/ImageMagick-6/magick/magick-baseconfig.h /registry/include/ImageMagick-7/magick/magick-baseconfig.h /registry/include/magick/magick-baseconfig.h
The item was not found.
Call Stack (most recent call first): /snap/cmake/1082/share/cmake-3.23/Modules/FindImageMagick.cmake:204 (FIND_IMAGEMAGICK_API) CMakeLists.txt:105 (find_package)
CMake Debug Log at /snap/cmake/1082/share/cmake-3.23/Modules/FindImageMagick.cmake:126 (find_library): find_library called with the following settings:
VAR: ImageMagick_Magick++_LIBRARY NAMES: "Magick++" "CORE_RL_Magick++_" "Magick++-6" "Magick++-7" "Magick++-Q8" "Magick++-Q16" "Magick++-Q16HDRI" "Magick++-Q8HDRI" "Magick++-6.Q64" "Magick++-6.Q32" "Magick++-6.Q64HDRI" "Magick++-6.Q32HDRI" "Magick++-6.Q16" "Magick++-6.Q8" "Magick++-6.Q16HDRI" "Magick++-6.Q8HDRI" "Magick++-7.Q64" "Magick++-7.Q32" "Magick++-7.Q64HDRI" "Magick++-7.Q32HDRI" "Magick++-7.Q16" "Magick++-7.Q8" "Magick++-7.Q16HDRI" "Magick++-7.Q8HDRI" Documentation: Path to the ImageMagick Magick++ library. Framework Only Search Frameworks: 0 Search Frameworks Last: 0 Search Frameworks First: 0 AppBundle Only Search AppBundle: 0 Search AppBundle Last: 0 Search AppBundle First: 0 NO_DEFAULT_PATH Enabled
find_library considered the following locations:
/registry/lib/(lib)Magick++(\.so|\.a) /registry/lib/(lib)CORE_RL_Magick++_(\.so|\.a) /registry/lib/(lib)Magick++-6(\.so|\.a) /registry/lib/(lib)Magick++-7(\.so|\.a) /registry/lib/(lib)Magick++-Q8(\.so|\.a) /registry/lib/(lib)Magick++-Q16(\.so|\.a) /registry/lib/(lib)Magick++-Q16HDRI(\.so|\.a) /registry/lib/(lib)Magick++-Q8HDRI(\.so|\.a) /registry/lib/(lib)Magick++-6.Q64(\.so|\.a) /registry/lib/(lib)Magick++-6.Q32(\.so|\.a) /registry/lib/(lib)Magick++-6.Q64HDRI(\.so|\.a) /registry/lib/(lib)Magick++-6.Q32HDRI(\.so|\.a) /registry/lib/(lib)Magick++-6.Q16(\.so|\.a) /registry/lib/(lib)Magick++-6.Q8(\.so|\.a) /registry/lib/(lib)Magick++-6.Q16HDRI(\.so|\.a) /registry/lib/(lib)Magick++-6.Q8HDRI(\.so|\.a) /registry/lib/(lib)Magick++-7.Q64(\.so|\.a) /registry/lib/(lib)Magick++-7.Q32(\.so|\.a) /registry/lib/(lib)Magick++-7.Q64HDRI(\.so|\.a) /registry/lib/(lib)Magick++-7.Q32HDRI(\.so|\.a) /registry/lib/(lib)Magick++-7.Q16(\.so|\.a) /registry/lib/(lib)Magick++-7.Q8(\.so|\.a) /registry/lib/(lib)Magick++-7.Q16HDRI(\.so|\.a) /registry/lib/(lib)Magick++-7.Q8HDRI(\.so|\.a)
The item was not found.
Call Stack (most recent call first): /snap/cmake/1082/share/cmake-3.23/Modules/FindImageMagick.cmake:204 (FIND_IMAGEMAGICK_API) CMakeLists.txt:105 (find_package)
CMake Error at /snap/cmake/1082/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find ImageMagick (missing: ImageMagick_Magick++_LIBRARY) (found version "7.1.0-34") Call Stack (most recent call first): /snap/cmake/1082/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE) /snap/cmake/1082/share/cmake-3.23/Modules/FindImageMagick.cmake:281 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:105 (find_package)
CMake Debug Log at CMakeLists.txt:105 (find_package): find_package considered the following paths for FindImageMagick.cmake:
/home/fins/development/tqswip/printer/cmake/FindImageMagick.cmake
The file was found at
/snap/cmake/1082/share/cmake-3.23/Modules/FindImageMagick.cmake
-- Configuring incomplete, errors occurred!
Possible fixes
Add a find_package(PkgConfig REQUIRED)
to the FindImageMagick