Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make cmake find a package configuration file

Tags:

cmake

qt

pyside

I'm trying to cmake a project which calls

find_package(Shiboken REQUIRED)

cmake complains about

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

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

    ShibokenConfig.cmake
    shiboken-config.cmake

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

I do have Shiboken compiled and installed to C:\Program Files\shiboken. And I can see there are cmake files like ShibokenConfig.cmake, ShibokenConfig-python2.7.cmake, ShibokenConfigVersion.cmake under folder C:\Program Files\shiboken\lib\cmake\Shiboken-1.1.2

how do I let the cmake know it should search for ShibokenConfig.cmake in that folder?

like image 484
zhongzhu Avatar asked Jan 09 '13 07:01

zhongzhu


People also ask

How does CMake find a package?

CMake searches for a file called Find<package>. cmake in the CMAKE_MODULE_PATH followed by the CMake installation. If the file is found, it is read and processed by CMake. It is responsible for finding the package, checking the version, and producing any needed messages.

What is package configuration file in CMake?

Config-file Packages A config-file package is a set of files provided by upstreams for downstreams to use. CMake searches in a number of locations for package configuration files, as described in the find_package() documentation.

Where are CMake packages installed?

CMake ships with its own set of built-in find_package scripts, and their location is in the default CMAKE_MODULE_PATH. The more normal use case for dependent projects that have been CMakeified would be to use CMake's external_project command and then include the Use[Project]. cmake file from the subproject.


1 Answers

One of Shiboken's contributors answered my question through email and I confirmed it's working.

The solution:

cmake .. -G"MinGW Makefiles" -DShiboken_DIR=C:\shiboken\lib\cmake\Shiboken-1.1.2

Note: I copied C:\Program Files\shiboken to C:\shiboken because cmake complains about "C:\Program Files" (maybe caused by the space in it).

like image 64
zhongzhu Avatar answered Oct 11 '22 16:10

zhongzhu