diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c3780bf3..c8186e095 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/INSTALL.md b/INSTALL.md index 68b064d41..1fad5b71c 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -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 diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index d246681d9..7504c605a 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -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) diff --git a/lib/db_ido_mysql/CMakeLists.txt b/lib/db_ido_mysql/CMakeLists.txt index a2799ac39..c81fbdacd 100644 --- a/lib/db_ido_mysql/CMakeLists.txt +++ b/lib/db_ido_mysql/CMakeLists.txt @@ -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() diff --git a/lib/db_ido_pgsql/CMakeLists.txt b/lib/db_ido_pgsql/CMakeLists.txt index 0136a6d5a..912b0c30d 100644 --- a/lib/db_ido_pgsql/CMakeLists.txt +++ b/lib/db_ido_pgsql/CMakeLists.txt @@ -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()