How to prevent cmake from getting source if the package is already installed.

System x86_64, Fedora_35. I am trying to build LinuxDeploy locally. This consistently fails in CImg . This is header-only source, which is installed via the package manager (package CImg-devel on Fedora). Two problems:

  • It does not see that it is installed.
  • If pulls down the source from github, and it still does not find it.
    It requires “CImgConfig.cmake” and “cimg-config.cmake” but the sources contains only the .h files. It looks to me that it wants to build CImg again, but why?
    How can I fix this?

Does LinuxDeploy (whatever that is) care? Is it searching for CImg or does it just always download it. If it isn’t searching, CMake can’t do anything about it.

It sounds like a LinuxDeploy problem to me. I’d talk with its developers.

  Ben Boeckel ben.boeckel 

February 25> MatN:

It does not see that it is installed.
Does LinuxDeploy (whatever that is) care?

Linuxdeploy is an AppImage builder
(https://github.com/linuxdeploy/linuxdeploy). Getting the source (git
or zip) gets a linuxdeploy-master directory with the source/build/test
stuff below it. It includes CImg.h in
linuxdeploy-master/src/core/appdir.cpp . Have not looked why it uses an
image manupilation library.

Is it searching for CImg or does it just always download it. If it
isn’t searching, CMake can’t do anything about it.

MatN:
How can I fix this?
It sounds like a LinuxDeploy problem to me. I’d talk with its
developers.

Eh, how can this be an linuxdeploy problem? By including a simple
include file?

linuxdeploy is normally built by running ci/build.sh from the
linuxdeploy-master dirctory, but then it gives the another complaint
about not finding boost (also headers only), which is installed:

If LinuxDeploy doesn’t search for CImg properly, how else is CMake supposed to know what to find?

I glanced at the project and it has a FindCImg.cmake file in the repository. You’ll have to investigate why it doesn’t find things on your machine. The --debug-find flag to CMake should be able to shed some light there.

The --debug-find and --debug-trycompile flags were very helpful, thanks for the tip. It found the FindCImg.cmake after adding -DCMAKE_MODULE_PATH="$REPO_ROOT"/cmake/Modules to Cmake’s cmd line. However, there is more wrong with the project: the include directory is in the wrong place, several sources file are missing which are actually part of the program, a dependency on args.hxx is nowhere specified; after fixing all that, it still fails to link. The source I retrieved is not compilable.

This sounds like something to discuss with LinuxDeploy to me as this is their scripts at this point not handling your setup. Their install instructions and/or Find* code don’t seem to account for whatever environment you have around.

I agree, I’ll take it up with them.
Thank you for your assistance.

Mat