Skip to content

Commit

Permalink
Merged r1920712 from apr/trunk:
Browse files Browse the repository at this point in the history
* CMake: Add support to build DBD PostgreSQL module.

git-svn-id: https://svn.apache.org/repos/asf/apr/apr-util/branches/1.7.x@1920811 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Ivan Zhakov committed Sep 20, 2024
1 parent 07f0c1f commit ef7c97c
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 @@ -39,6 +39,7 @@ CMAKE_DEPENDENT_OPTION(APU_DSO_BUILD "Use DSO build of modular components" ON "B
OPTION(APU_HAVE_CRYPTO "Crypto support" OFF)
OPTION(APU_HAVE_ODBC "Build ODBC DBD driver" ON)
OPTION(APU_HAVE_SQLITE3 "Build SQLite3 DBD driver" OFF)
OPTION(APU_HAVE_PGSQL "Build PostgreSQL DBD driver" OFF)
OPTION(APR_HAS_LDAP "LDAP support" OFF)
OPTION(INSTALL_PDB "Install .pdb files (if generated)" ON)
OPTION(APU_BUILD_TEST "Build the test suite" OFF)
Expand Down Expand Up @@ -74,6 +75,10 @@ IF(APU_HAVE_SQLITE3)
FIND_PACKAGE(SQLite3 REQUIRED)
ENDIF()

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

# create 1-or-0 representation of feature tests for apu.h

SET(apu_have_apr_iconv_10 0) # not yet implemented
Expand Down Expand Up @@ -321,6 +326,16 @@ IF(APU_HAVE_SQLITE3)
"SQLite::SQLite3")
ENDIF()

IF(APU_HAVE_PGSQL)
LIST(APPEND dbd_drivers pgsql)

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

ADD_COMPILE_DEFINITIONS(HAVE_LIBPQ_FE_H)
ENDIF()

ADD_LIBRARY(libaprutil-1 ${APR_SOURCES} ${APU_EXTRA_SOURCES} ${APR_PUBLIC_HEADERS_GENERATED})
LIST(APPEND install_targets libaprutil-1)
TARGET_LINK_LIBRARIES(libaprutil-1
Expand Down Expand Up @@ -437,6 +452,7 @@ MESSAGE(STATUS " Directory for include files ... : PREFIX/${APU_INSTALL_INCLU
MESSAGE(STATUS " C compiler ...................... : ${CMAKE_C_COMPILER}")
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 " APU_HAVE_CRYPTO ................. : ${APU_HAVE_CRYPTO}")
MESSAGE(STATUS " APR_HAS_LDAP .................... : ${APR_HAS_LDAP}")
MESSAGE(STATUS " Use Expat ....................... : ${APU_USE_EXPAT}")
Expand Down
3 changes: 2 additions & 1 deletion README.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ How to build
Default: OFF
APU_HAVE_ODBC Build ODBC DBD driver
Default: ON
APU_HAVE_PGSQL Build PostgreSQL DBD driver
Default: OFF
APU_BUILD_TEST Build APR-Util test suite
Default: OFF
TEST_STATIC_LIBS Build the test suite to test the APR static
Expand Down Expand Up @@ -114,7 +116,6 @@ Known Bugs and Limitations
. APU_HAVE_NDBM
. APU_HAVE_DB
+ DBD:
. APU_HAVE_PGSQL
. APU_HAVE_MYSQL
. APU_HAVE_SQLITE3
. APU_HAVE_SQLITE2
Expand Down
2 changes: 1 addition & 1 deletion include/apu.hwc
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@
* Win32 always has odbc (it's always installed)
*/
#ifndef APU_DSO_MODULE_BUILD
#define APU_HAVE_PGSQL 0
#define APU_HAVE_MYSQL 0
#define APU_HAVE_SQLITE2 0
#define APU_HAVE_ORACLE 0
#endif

#cmakedefine01 APU_HAVE_ODBC
#cmakedefine01 APU_HAVE_SQLITE3
#cmakedefine01 APU_HAVE_PGSQ
#cmakedefine01 APU_HAVE_CRYPTO

#ifndef APU_DSO_MODULE_BUILD
Expand Down

0 comments on commit ef7c97c

Please sign in to comment.