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

Ilia Choly ilia.choly at gmail.com
Tue Dec 18 09:20:08 EST 2012


On 12-12-17 03:11 PM, Matthew Woehlke wrote:
> On 2012-12-17 14:55, Ilia Choly wrote:
>> I'm trying to get the `FindPostgreSQL` module to find
>> `/usr/include/postgresql/libpq-fe.h`.
>>
>> 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")
>
> Is pg_config in your PATH? (Do you have the necessary -dev package(s) 
> installed?)
>
> From a cursory look at the find module, it looks like having pg_config 
> in your path should be all that is needed.
>

The pg_config binary is in my path but looking at he module it doesn't 
look like it's being used.

After a bit more debugging I figured out that it's getting stuck here 
trying to find pg_type.h
This file is located in /usr/include/postgresql/catalog/pg_types.h but 
the module is expecting to find it in 
/usr/postgresql/server/catalog/pg_types.h

     find_path(PostgreSQL_TYPE_INCLUDE_DIR
       NAMES catalog/pg_type.h
       PATHS
        # Look in other places.
        ${PostgreSQL_ROOT_DIRECTORIES}
       PATH_SUFFIXES
         pgsql/server
         postgresql/server
         include/server
       # Help the user find it if we cannot.
       DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}"
     )

It works if I add postgresql to the PATH_SUFFIXES

- icholy



More information about the CMake mailing list