2 # Copyright (C) 2012-2017 Icinga Development Team (https://www.icinga.com/)
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation
16 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
18 find_package(PostgreSQL)
21 mkclass_target(idopgsqlconnection.ti idopgsqlconnection.tcpp idopgsqlconnection.thpp)
23 link_directories(${PostgreSQL_LIBRARY_DIRS})
24 include_directories(${PostgreSQL_INCLUDE_DIRS})
26 set(db_ido_pgsql_SOURCES
27 idopgsqlconnection.cpp idopgsqlconnection.thpp
30 if(ICINGA2_UNITY_BUILD)
31 mkunity_target(db_ido_pgsql db_ido_pgsql db_ido_pgsql_SOURCES)
34 add_library(db_ido_pgsql SHARED ${db_ido_pgsql_SOURCES})
36 target_link_libraries(db_ido_pgsql ${Boost_LIBRARIES} ${PostgreSQL_LIBRARIES} base config icinga db_ido)
38 set_target_properties (
39 db_ido_pgsql PROPERTIES
40 INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
41 DEFINE_SYMBOL I2_DB_IDO_PGSQL_BUILD
43 VERSION ${SPEC_VERSION}
46 install_if_not_exists(
47 ${PROJECT_SOURCE_DIR}/etc/icinga2/features-available/ido-pgsql.conf
48 ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available
53 RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
54 LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
59 DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2-ido-pgsql
60 FILES_MATCHING PATTERN "*.sql"
64 DIRECTORY schema/upgrade
65 DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2-ido-pgsql/schema
66 FILES_MATCHING PATTERN "*.sql"
69 set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" PARENT_SCOPE)
71 message(FATAL_ERROR "You have selected PostgreSQL support, but PostgreSQL could not be found. You can disable the PostgreSQL IDO module using -DICINGA2_WITH_PGSQL=OFF.")