问题
I m trying compile gammu 1.38.5 on my mac os x El Capitan with postgresql native lib support by fellowing instruction I found in Gammu document.
I had my PostgreSQL 9.4 installed and running my Mac OS X as database server. smsd database and user was created to support Gammu SMS gateway services. PostgreSQL was installed in default location /Library/PostgreSQL/9.4 in Mac OSX. include and lib directory can be found here.
I had set up POSTGRESQL_PATH point to /Library/PostgreSQL/9.4 and then export it to shell, I checked with FindPostgres.cmake, make sure the included file libpq-fe.h is here and then run cmake to configure it.
I tried to use cmake to with postgresql enabled by set:
sudo cmake -DWITH_MYSQL=OFF -DWITH_Postgres=ON -Wno-dev
cmake not found my postgresql default installation, shows:
-- Could not find PostgreSQL
I thought maybe have manually specify the location of include/lib in command line.
I tried to:
sudo cmake -DWITH_MYSQL=OFF -DWITH_Postgres=ON -Wno-dev -DWITH_POSTGRES_INCLUDE_DIR=/Library/PostgreSQL/9.4/include -DWITH_POSTGRES_LIBRARY=/Library/PostgreSQL/9.4/lib
cmake still can not found my specified postgresql include/lib, shows:
-- Could not find PostgreSQL
and shows more information at the end as:
CMake Warning:
Manually-specified variables were not used by the project:
WITH_POSTGRES_INCLUDE_DIR
WITH_POSTGRES_LIBRARY
if manually variables can't be used, How I can pass the environment variables to cmake?
回答1:
Following should work:
cmake -DPOSTGRES_CONFIG_PREFER_PATH=/Library/PostgreSQL/9.4/bin/
Anyway the lookup should work better in future versions, see https://github.com/gammu/gammu/commit/d9d09574be1d0afa0609626d3bd6f604be31b8d4
来源:https://stackoverflow.com/questions/47119701/gammu-1-38-5-compile-with-native-pgsql-could-not-find-postgresql