[CMake] FindPostgreSQL.cmake won't work on ubuntu

Ilia Choly ilia.choly at gmail.com
Mon Dec 17 14:55:53 EST 2012


* Ubuntu 12.04
* CMake 2.8.9
* Postgresql 9.2.2

I'm trying to get the `FindPostgreSQL` module to find 
`/usr/include/postgresql/libpq-fe.h`.

Here's what I have in my `CMakeLists.txt`:

     find_package(PostgreSQL REQUIRED)

This is the error I get:

     CMake Error at 
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 
(MESSAGE):
       Could NOT find PostgreSQL (missing: PostgreSQL_TYPE_INCLUDE_DIR) 
(found
       version "9.2.2")
     Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:288 
(_FPHSA_FAILURE_MESSAGE)
       /usr/share/cmake-2.8/Modules/FindPostgreSQL.cmake:155 
(find_package_handle_standard_args)
       CMakeLists.txt:7 (find_package)


I added the following lines before calling `find_package` but it didn't 
seem to have any effect.

     set(PostgreSQL_ADDITIONAL_VERSIONS "9.2.2")
     set(PostgreSQL_ADDITIONAL_SEARCH_PATHS 
${PostgreSQL_ADDITIONAL_SEARCH_PATHS} "/usr/include/postgresql")

I also tried googling for `PostgreSQL_TYPE_INCLUDE_DIR` but didn't find 
anything.
I'm very new to cmake, what else can I try?

- icholy


More information about the CMake mailing list