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

**URL:** https://discourse.cmake.org/t/how-to-prevent-cmake-from-getting-source-if-the-package-is-already-installed/5114
**Category:** Usage
**Tags:** os:linux
**Created:** [February 25, 2022, 11:01am UTC](https://discourse.cmake.org/t/how-to-prevent-cmake-from-getting-source-if-the-package-is-already-installed/5114 "2022-02-25T11:01:21Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![MatN](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/5daacb/32.png) [@MatN](https://discourse.cmake.org/u/MatN)
#### Post date: [February 25, 2022, 11:01am UTC](https://discourse.cmake.org/t/how-to-prevent-cmake-from-getting-source-if-the-package-is-already-installed/5114/1 "2022-02-25T11:01:21Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 25, 2022, 12:16pm UTC](https://discourse.cmake.org/t/how-to-prevent-cmake-from-getting-source-if-the-package-is-already-installed/5114/2 "2022-02-25T12:16:53Z")

</div>

> [@MatN](#):
>
> It does not see that it is installed.

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.

> [@MatN](#):
>
> How can I fix this?

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

---

<div class="post-metadata">

### Author: ![MatN](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/5daacb/32.png) [@MatN](https://discourse.cmake.org/u/MatN)
#### Post date: [February 25, 2022, 2:07pm UTC](https://discourse.cmake.org/t/how-to-prevent-cmake-from-getting-source-if-the-package-is-already-installed/5114/3 "2022-02-25T14:07:22Z")

</div>

> ```
> 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  
([GitHub - linuxdeploy/linuxdeploy: AppDir creation and maintenance tool. Featuring flexible plugin system.](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:

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 25, 2022, 5:53pm UTC](https://discourse.cmake.org/t/how-to-prevent-cmake-from-getting-source-if-the-package-is-already-installed/5114/4 "2022-02-25T17:53:38Z")

</div>

> [@MatN](#):
>
> Eh, how can this be an linuxdeploy problem? By including a simple  
> include file?

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.

---

<div class="post-metadata">

### Author: ![MatN](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/5daacb/32.png) [@MatN](https://discourse.cmake.org/u/MatN)
#### Post date: [February 27, 2022, 9:00pm UTC](https://discourse.cmake.org/t/how-to-prevent-cmake-from-getting-source-if-the-package-is-already-installed/5114/5 "2022-02-27T21:00:32Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 28, 2022, 3:22pm UTC](https://discourse.cmake.org/t/how-to-prevent-cmake-from-getting-source-if-the-package-is-already-installed/5114/6 "2022-02-28T15:22:35Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![MatN](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/5daacb/32.png) [@MatN](https://discourse.cmake.org/u/MatN)
#### Post date: [February 28, 2022, 3:37pm UTC](https://discourse.cmake.org/t/how-to-prevent-cmake-from-getting-source-if-the-package-is-already-installed/5114/7 "2022-02-28T15:37:07Z")

</div>

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

Mat
