[CMake] project(), find_package()

Nico Schlömer nico.schloemer at gmail.com
Mon Apr 13 04:40:47 EDT 2015


Hi everyone,

I have a CMake project where I need to find the third-party package
```
FIND_PACKAGE(Trilinos REQUIRED)
```
which sits in the custom folder
```
/path/to/lib/x86_64-linux-gnu/cmake/Trilinos/TrilinosConfig.cmake
```
Unfortunately, simply extending the CMAKE_PREFIX_PATH
```
CMAKE_PREFIX_PATH=/path/to/:$CMAKE_PREFIX_PATH \
cmake ../source/
```
did not do the trick:
```
CMake Error at CMakeLists.txt:25 (FIND_PACKAGE):
  By not providing "FindTrilinos.cmake" in CMAKE_MODULE_PATH this project
has
  asked CMake to find a package configuration file provided by "Trilinos",
  but CMake did not find one.

  Could not find a package configuration file provided by "Trilinos" with
any
  of the following names:

    TrilinosConfig.cmake
    trilinos-config.cmake
[...]
```
What *does* help was setting the `project()` *before* `find_package()`. Is
this something that documented anywhere?

Cheers,
Nico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150413/f9d5a09b/attachment.html>


More information about the CMake mailing list