6

I have found in library Poco under contrib a PocoConfig.cmake which I've copied under /cmake/Modules

I also added in my CMakeLists.txt:

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

Now I run under /Build/cmake ..

And I keep getting:

CMake Error at CMakeLists.txt:41 (find_package):
  By not providing "FindPoco.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Poco", but
  CMake did not find one.

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

    PocoConfig.cmake
    poco-config.cmake

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

Obviously CMake is not finding the module file. What am I doing wrong, how to explicitly point CMake to that module file?

Ælex
  • 14,432
  • 20
  • 88
  • 129
  • Did you try to `Add the installation prefix of "Poco" to CMAKE_PREFIX_PATH or set "Poco_DIR" to a directory containing one of the above files`? – Massimiliano Jun 07 '13 at 10:31
  • @Massimiliano I am assuming you mean something like this: http://stackoverflow.com/questions/15639781/how-to-find-qt5-cmake-module-on-windows ? I just tried it, and I keep getting the same error. – Ælex Jun 07 '13 at 17:36
  • debian/ubuntu libpoco-dev caused this error until recently. c.f. https://github.com/pocoproject/poco/issues/3244 . Now fixed in sid, coming to bullseye real soon now. – John Vandenberg Nov 29 '21 at 04:00

2 Answers2

3

The PocoConfig.cmake doesn't works with find_package (otherwise, it would be named FindPoco.cmake), that's why you're getting this error.

Just include the PocoConfig.cmake in your CMakeLists.txt with:

include(${CMAKE_SOURCE_DIR}/cmake/Modules/PocoConfig.cmake)
Guillaume
  • 10,463
  • 1
  • 33
  • 47
  • Unfortunately this doesn't seem to work either. I keep getting the exact same error about not finding FindPoco. I've added the include line and called find_package, I am assuming this is what you meant? Or should I just include it and use find_library instead? – Ælex Jun 07 '13 at 17:32
  • Just include it, don't call find_package. – Guillaume Jun 07 '13 at 18:22
  • So how is that different from calling find_library( PocoFoundation PATHS ... )? Will it do a better job searching? – Ælex Jun 07 '13 at 18:23
  • 1
    that's what it's doing, it just knows more paths to search, etc. but yeah, you could do the same with find_path / find_library – Guillaume Jun 07 '13 at 18:28
  • Well thank you for all your help. I shall try this with the problematic computer and see if it makes a difference. Unfortunately, for reasons beyond me, the exact same CMakeLists.txt used in the identical (but physically different) machines, fails on one, works perfect on the other. – Ælex Jun 07 '13 at 18:29
  • 3
    PocoConfig.cmake is meant for find_package in Config mode (as opposed to Module mode with FindPoco.cmake). You need to add the POCO installation directory in the CMAKE_PREFIX_PATH variable. See the find_package documentation for more into. – James Hirschorn Mar 07 '16 at 19:32
0

I've had similar issues. In my case I was recompiling with an old build folder in place - deleting the folder and recompiling worked.