Add support to conditionally use MysSQL and/or PostgreSQL

refs #7680

Signed-off-by: Gunnar Beutner <gunnar.beutner@netways.de>
This commit is contained in:
Lars Engels 2014-11-13 22:37:12 +01:00 committed by Gunnar Beutner
parent 9217ea3143
commit b81bb67910
5 changed files with 22 additions and 5 deletions

View File

@ -28,6 +28,9 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif()
option(ICINGA2_WITH_MYSQL "MySQL support" ON)
option(ICINGA2_WITH_PGSQL "PostgreSQL support" ON)
file(STRINGS icinga2.spec VERSION_LINE REGEX "^Version: ")
string(REPLACE "Version: " "" ICINGA2_VERSION ${VERSION_LINE})

View File

@ -25,9 +25,12 @@ parentheses):
* Boost library and header files (boost-devel on RHEL, libboost-all-dev on Debian)
* GNU bison (bison)
* GNU flex (flex) >= 2.5.35
* recommended: libexecinfo on FreeBSD
* optional: MySQL (mysql-devel on RHEL, libmysqlclient-dev on Debian)
* optional: PostgreSQL (postgresql-devel on RHEL, libpq-dev on Debian)
* recommended: libexecinfo on FreeBSD (automatically used when Icinga 2 is
installed via port or package)
* optional: MySQL (mysql-devel on RHEL, libmysqlclient-dev on Debian) set CMake
variable `ICINGA2_WITH_MYSQL` to enable
* optional: PostgreSQL (postgresql-devel on RHEL, libpq-dev on Debian) set CMake
variable `ICINGA2_WITH_PGSQL` to enable
* optional: YAJL (yajl-devel on RHEL, libyajl-dev on Debian)
Note: RHEL5 ships an ancient flex version. Updated packages are available for

View File

@ -25,8 +25,15 @@ add_subdirectory(hello)
add_subdirectory(remote)
add_subdirectory(checker)
add_subdirectory(compat)
add_subdirectory(db_ido_mysql)
add_subdirectory(db_ido_pgsql)
if(ICINGA2_WITH_MYSQL)
add_subdirectory(db_ido_mysql)
endif()
if(ICINGA2_WITH_PGSQL)
add_subdirectory(db_ido_pgsql)
endif()
add_subdirectory(demo)
add_subdirectory(livestatus)
add_subdirectory(notification)

View File

@ -58,4 +58,6 @@ if(MYSQL_FOUND)
DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2-ido-mysql/schema
FILES_MATCHING PATTERN "*.sql"
)
else()
message( FATAL_ERROR "You have selected MySQL support, but MySQL could not be found." )
endif()

View File

@ -60,4 +60,6 @@ if(PostgreSQL_FOUND)
DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2-ido-pgsql/schema
FILES_MATCHING PATTERN "*.sql"
)
else()
message( FATAL_ERROR "You have selected PostgreSQL support, but PostgreSQL could not be found." )
endif()