# CMake unable to find preciceConfig.cmake

**URL:** <https://precice.discourse.group/t/cmake-unable-to-find-preciceconfig-cmake/627>\
**Category:** Installing preCICE\
**Tags:** cmake\
**Created:** [June 18, 2021, 1:25pm UTC](https://precice.discourse.group/t/cmake-unable-to-find-preciceconfig-cmake/627 "2021-06-18T13:25:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rachaelesmith](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/rachaelesmith/32/682_2.png) [@rachaelesmith](https://precice.discourse.group/u/rachaelesmith)\
**Post date:** [June 18, 2021, 1:25pm UTC](https://precice.discourse.group/t/cmake-unable-to-find-preciceconfig-cmake/627/1 "2021-06-18T13:25:06Z")

</div>

Hi,

I get the following error when I run cmake in any of the tests in solverdummies:

```plaintext
CMake Error at CMakeLists.txt:4 (find_package):
  Could not find a package configuration file provided by "precice" with any
  of the following names:

    preciceConfig.cmake
    precice-config.cmake

  Add the installation prefix of "precice" to CMAKE_PREFIX_PATH or set
  "precice_DIR" to a directory containing one of the above files. If
  "precice" provides a separate development package or SDK, be sure it has
  been installed.

```

I am using CMake 3.11.4 and precice-2.2.0. I noticed this issue when I tried to build the dealii adapter, as even when I set `-Dprecice_DIR` correctly I got this error. When I set `CMAKE_PREFIX_PATH` instead, I got the error that cmake was unable to load `cmake/preciceTargets.cmake`.  
Any ideas for why this might be? I have also been using this same version of precice with the openfoam adapter and calculix adapter without any installation issues.

Thanks in advance for your help,  
Rachael

---

<div class="post-metadata">

**Author:** ![Makis](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/makis/32/25_2.png) [@Makis](https://precice.discourse.group/u/Makis)\
**Post date:** [June 19, 2021, 2:04pm UTC](https://precice.discourse.group/t/cmake-unable-to-find-preciceconfig-cmake/627/2 "2021-06-19T14:04:06Z")

</div>

I tried to debug this live with Rachael, the most strange part was that in the `CMakeCache.txt`, the file that was reported to not exist, was actually there, owned by the same user, and non-empty.

---

<div class="post-metadata">

**Author:** ![fsimonis](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/fsimonis/32/6_2.png) [@fsimonis](https://precice.discourse.group/u/fsimonis)\
**Post date:** [June 21, 2021, 8:47am UTC](https://precice.discourse.group/t/cmake-unable-to-find-preciceconfig-cmake/627/3 "2021-06-21T08:47:28Z")

</div>

Hi, lets first ensure the installation is working.  
Could you please check the following:

1. Please make sure that preCICE is build as a shared library. `-DBUILD_SHARED_LIBS=ON`
2. Please run `make install && make test_install` in the binary directory of preCICE. This will attempt to build the cpp solverdummy against the preCICE installation. This is also known as a smoke test.
3. In case you use `precice_DIR`, ensure that the `precice_DIR` contains the files `preciceConfig.cmake` and `preciceTargets.cmake`.

Best regards  
Frédéric

---

<div class="post-metadata">

**Author:** ![rachaelesmith](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/rachaelesmith/32/682_2.png) [@rachaelesmith](https://precice.discourse.group/u/rachaelesmith)\
**Post date:** [June 21, 2021, 10:45am UTC](https://precice.discourse.group/t/cmake-unable-to-find-preciceconfig-cmake/627/4 "2021-06-21T10:45:10Z")

</div>

Hi Frédéric,

I have built preCICE as a shared library. Here are the log files from running make install and make test\_install. When I ran make test\_install I got the same cmake error (unable to find cmake/preciceTargets.cmake)

[install.log](https://precice.discourse.group/uploads/short-url/ycSGd9NXn2qp6Ec6BAlivv3qz5e.log) (11.1 KB)  
[testinstall.log](https://precice.discourse.group/uploads/short-url/fsCq48OH3eLnpXDDk2zhoWSZibk.log) (784 Bytes)

Many thanks,  
Rachael

---

<div class="post-metadata">

**Author:** ![rachaelesmith](https://yyz2.discourse-cdn.com/free1/user_avatar/precice.discourse.group/rachaelesmith/32/682_2.png) [@rachaelesmith](https://precice.discourse.group/u/rachaelesmith)\
**Post date:** [June 21, 2021, 3:23pm UTC](https://precice.discourse.group/t/cmake-unable-to-find-preciceconfig-cmake/627/5 "2021-06-21T15:23:11Z")

</div>

I seem to have it working now. When I set `CMAKE_PREFIX_PATH=$precice_install_dir`, `precice_DIR=$precice_install_dir/lib64/cmake/precice` and added `precice_install_dir/include` to `CPATH`, everything worked. Sorry for the trouble

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/precice/original/1X/67d2a5fa6f80e597e2267ff17fa8c1673cd11caa.svg) [@system](https://precice.discourse.group/u/system)\
**Post date:** [June 24, 2021, 3:23pm UTC](https://precice.discourse.group/t/cmake-unable-to-find-preciceconfig-cmake/627/6 "2021-06-24T15:23:37Z")

</div>

Closed on June 24, 2021, 3:23pm UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
