Skip to content

Commit

Permalink
CMake: Search only for packages needed for enabled features.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1920696 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Ivan Zhakov committed Sep 15, 2024
1 parent f5cb461 commit 857c13e
Showing 1 changed file with 15 additions and 27 deletions.
42 changes: 15 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,16 @@ ENDIF()

OPTION(APR_MINIMAL_BUILD "Create minimal APR build" OFF)
IF(NOT APR_MINIMAL_BUILD)
FIND_PACKAGE(EXPAT)
FIND_PACKAGE(LibXml2)
FIND_PACKAGE(OpenSSL)
FIND_PACKAGE(Iconv)
FIND_PACKAGE(SQLite3)
OPTION(APU_HAVE_ODBC "Build ODBC DBD driver" ON)
ELSE()
OPTION(APU_HAVE_ODBC "Build ODBC DBD driver" OFF)
ENDIF()

SET(apr_libname libapr-2)

IF(NOT APU_USE_EXPAT AND NOT APU_USE_LIBXML2 AND NOT APU_USE_XMLLITE)
OPTION(APU_USE_EXPAT "Use Expat" OFF)
OPTION(APU_USE_LIBXML2 "Use LibXml2" OFF)
OPTION(APU_USE_XMLLITE "Use XmlLite" ON)
ENDIF()

IF(APU_USE_EXPAT AND NOT EXPAT_FOUND)
MESSAGE(FATAL_ERROR "Expat not found")
ENDIF()

IF(APU_USE_LIBXML2 AND NOT LIBXML2_FOUND)
MESSAGE(FATAL_ERROR "LibXml2 not found")
ENDIF()

OPTION(APU_USE_EXPAT "Use Expat" OFF)
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_CRYPTO "Crypto support" OFF)
Expand Down Expand Up @@ -92,19 +76,23 @@ IF(APR_MODULAR_DSO AND NOT BUILD_SHARED_LIBS)
ENDIF()

IF(APU_HAVE_CRYPTO)
IF(NOT OPENSSL_FOUND)
MESSAGE(FATAL_ERROR "OpenSSL is the only supported crypto implementation, and it wasn't found!")
FIND_PACKAGE(OpenSSL REQUIRED)
ENDIF()

IF(APU_USE_EXPAT)
FIND_PACKAGE(EXPAT REQUIRED)
ENDIF()
IF(APU_HAVE_ICONV)
IF(NOT Iconv_FOUND)
MESSAGE(FATAL_ERROR "Libiconv wasn't found!")

IF(APU_USE_LIBXML2)
FIND_PACKAGE(LibXml2 REQUIRED)
ENDIF()

IF(APU_HAVE_ICONV)
FIND_PACKAGE(Iconv REQUIRED)
ENDIF()

IF(APU_HAVE_SQLITE3)
IF(NOT SQLite3_FOUND)
MESSAGE(FATAL_ERROR "SQLite3 wasn't found!")
ENDIF()
FIND_PACKAGE(SQLite3 REQUIRED)
ENDIF()

IF(APR_POOL_DEBUG)
Expand Down

0 comments on commit 857c13e

Please sign in to comment.