#1146487 libgmic-dev: find_package(Gmic) fails, exported target references missing CImg::CImg

Package:
libgmic-dev
Source:
libgmic-dev
Description:
GREYC's Magic for Image Computing - development files
Submitter:
Are Mehus
Date:
2026-09-02 12:57:02 UTC
Severity:
normal
#1146487#5
Date:
2026-09-02 12:57:43 UTC
From:
To:
Dear Maintainer,

Any CMake project that calls find_package(Gmic) fails at the generate step
with:

  CMake Error at /usr/lib/x86_64-linux-gnu/cmake/gmic/GmicTargets.cmake:71
  (set_target_properties):
    The link interface of target "libgmic" contains:
      CImg::CImg
    but the target was not found.

GmicTargets.cmake exports libgmic with CImg::CImg in its link interface, but
no package on the system provides that imported target, and GmicConfig.cmake
does not call find_package for it. Installing cimg-dev does not help --
cimg-dev ships the header only, not a CMake config defining CImg::CImg.

This makes libgmic-dev unusable for linking against system G'MIC from CMake.

Steps to reproduce:

  1. sudo apt install libgmic-dev
  2. Create a CMakeLists.txt containing:
       cmake_minimum_required(VERSION 3.20)
       project(t)
       find_package(Gmic REQUIRED)
  3. cmake -S . -B build

Expected: configuration succeeds.
Actual: fails as above.

I hit this while building the G'MIC-Qt plugin for Krita with
-DENABLE_SYSTEM_GMIC=ON. Building the engine from upstream source works, so
the problem is confined to the CMake export in the Debian package.

Possible fixes: ship a CMake config for CImg providing the CImg::CImg target,
add a find_dependency() call in GmicConfig.cmake, or drop CImg::CImg from the
exported link interface if the dependency is header-only and already handled
via include directories.