2

I was working on Qub3d which uses libCinder as a dep, and kept getting this weird error about not being able to find one of the pre-bundled cmake files.

CMake Error at dependencies/cinder/proj/cmake/modules/cinderMakeApp.cmake:65 (find_package):
  Could not find a package configuration file provided by "cinder" with any
  of the following names:

    cinderConfig.cmake
    cinder-config.cmake

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

So I looked around and found this solution, which boils down to running cmake .. in (cinder_dir)/build which somehow managed to let my project's Cmake build script to find the package cinder.

Does find_package() look for files that cmake .. generates?

If anyone could tell me why this works I would appreciate it very much.

TMcSquared
  • 107
  • 14
  • If you have to manually build the `cinder` package it's not correctly integrated in `Qub3d`. If I would have to guess the project is using the `externalproject_add()` macro. Generally see [here](https://stackoverflow.com/questions/31755870/how-to-use-libraries-within-my-cmake-project-that-need-to-be-installed-first), [here](https://stackoverflow.com/questions/15175318/cmake-how-to-build-external-projects-and-include-their-targets) or more specific [CMake Running find_package after dependencies are built](https://cmake.org/pipermail/cmake/2013-October/056105.html) – Florian Mar 01 '18 at 09:22
  • actually no, its using a pre-built macro from Cinder called `ci_make_app` – TMcSquared Mar 01 '18 at 13:52

1 Answers1

0

Turning my comment into an answer

If you have to manually build the cinder package it's not correctly integrated in Qub3d or - as Qub3d is using the cinder proposed way of integration - a bug in cinder library's CMake support.

Looking at the ci_make_app() code you were referring to, the find_package() call will only work if cinder is already build (generating the needed cinderConfig.cmake).

How does it work?

See the documentation of the find_package() for the details on the "search algorithm". In case of cinder the PATH argument simply points to where to find the cinderConfig.cmake file.

You can see what CMake's find_package() is doing by using cmake -D CMAKE_FIND_DEBUG_MODE=ON ..

References

Florian
  • 39,996
  • 9
  • 133
  • 149
  • This is what the person in the link I gave did to fix his problem: `Apologies, this works just fine! I missed the argument in one of the cmake commands. So you run “cmake -G"Visual Studio 14 2015 Win64” …" from CINDER_PATH/build and then again from your project proj/cmake/build folder. If errors you may need to delete the contents of the build folder if something was there previous.` – TMcSquared Mar 03 '18 at 13:18