Skip to content

Commit

Permalink
CMake: Add support to build PostgreSQL DBD driver.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1920712 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Ivan Zhakov committed Sep 16, 2024
1 parent 857c13e commit 6d2eeae
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ OPTION(APU_USE_LIBXML2 "Use LibXml2" OFF)
OPTION(APU_USE_XMLLITE "Use XmlLite" ON)
OPTION(APR_INSTALL_PRIVATE_H "Install selected private .h files (for httpd)" OFF)
OPTION(APU_HAVE_SQLITE3 "Build SQLite3 DBD driver" OFF)
OPTION(APU_HAVE_PGSQL "Build PostgreSQL DBD driver" OFF)
OPTION(APU_HAVE_CRYPTO "Crypto support" OFF)
OPTION(APU_HAVE_ICONV "Xlate support" OFF)
OPTION(APR_HAVE_IPV6 "IPv6 support" ON)
Expand Down Expand Up @@ -95,6 +96,10 @@ IF(APU_HAVE_SQLITE3)
FIND_PACKAGE(SQLite3 REQUIRED)
ENDIF()

IF(APU_HAVE_PGSQL)
FIND_PACKAGE(PostgreSQL REQUIRED)
ENDIF()

IF(APR_POOL_DEBUG)
ADD_COMPILE_DEFINITIONS(APR_POOL_DEBUG=1)
ENDIF()
Expand Down Expand Up @@ -542,6 +547,16 @@ IF(APU_HAVE_SQLITE3)
)
ENDIF()

IF(APU_HAVE_PGSQL)
LIST(APPEND dbd_drivers pgsql)

ADD_APR_MODULE(apr_dbd_pgsql-2 "apr_dbd_pgsql"
"dbd/apr_dbd_pgsql.c"
"PostgreSQL::PostgreSQL")

ADD_COMPILE_DEFINITIONS(HAVE_LIBPQ_FE_H)
ENDIF()

IF (BUILD_SHARED_LIBS)
ADD_LIBRARY(${apr_libname} SHARED ${APR_SOURCES} ${APR_EXTRA_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED} libapr.rc)
LIST(APPEND install_targets ${apr_libname})
Expand Down Expand Up @@ -765,6 +780,7 @@ MESSAGE(STATUS " C compiler ...................... : ${CMAKE_C_COMPILER}")
MESSAGE(STATUS " IPv6 ............................ : ${APR_HAVE_IPV6}")
MESSAGE(STATUS " DBD ODBC driver ................. : ${APU_HAVE_ODBC}")
MESSAGE(STATUS " DBD SQLite3 driver .............. : ${APU_HAVE_SQLITE3}")
MESSAGE(STATUS " DBD PostgreSQL .................. : ${APU_HAVE_PGSQL}")
MESSAGE(STATUS " Use Expat ....................... : ${APU_USE_EXPAT}")
MESSAGE(STATUS " Use LibXml2 ..................... : ${APU_USE_LIBXML2}")
MESSAGE(STATUS " Use XmlLite ..................... : ${APU_USE_XMLLITE}")
Expand Down
3 changes: 2 additions & 1 deletion README.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ How to build
Default: ON
APU_HAVE_SQLITE3 Build SQLite3 DBD driver
Default: OFF
APU_HAVE_PGSQL Build PostgreSQL DBD driver
Default: OFF
APR_HAVE_IPV6 Enable IPv6 support
Default: ON
APR_BUILD_TESTAPR Build APR test suite
Expand Down Expand Up @@ -115,7 +117,6 @@ Known Bugs and Limitations
. APU_HAVE_NDBM
. APU_HAVE_DB
+ DBD:
. APU_HAVE_PGSQL
. APU_HAVE_MYSQL
. APU_HAVE_SQLITE2
. APU_HAVE_ORACLE
Expand Down
2 changes: 1 addition & 1 deletion include/apr.hwc
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ typedef int apr_wait_t;
* are supported. The driver builds enable
* these flags individually.
*/
#define APU_HAVE_PGSQL 0
#cmakedefine01 APU_HAVE_PGSQL
#define APU_HAVE_MYSQL 0
#cmakedefine01 APU_HAVE_SQLITE3
#define APU_HAVE_SQLITE2 0
Expand Down

0 comments on commit 6d2eeae

Please sign in to comment.