]> granicus.if.org Git - icinga2/blob - lib/db_ido_pgsql/CMakeLists.txt
Merge pull request #5753 from Icinga/fix/ringbuffer-does-not-get-updated-if-nothing...
[icinga2] / lib / db_ido_pgsql / CMakeLists.txt
1 # Icinga 2
2 # Copyright (C) 2012-2017 Icinga Development Team (https://www.icinga.com/)
3 #
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.
8 #
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.
13 #
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.
17
18 find_package(PostgreSQL)
19
20 if(PostgreSQL_FOUND)
21   mkclass_target(idopgsqlconnection.ti idopgsqlconnection.tcpp idopgsqlconnection.thpp)
22
23   link_directories(${PostgreSQL_LIBRARY_DIRS})
24   include_directories(${PostgreSQL_INCLUDE_DIRS})
25
26   set(db_ido_pgsql_SOURCES
27     idopgsqlconnection.cpp idopgsqlconnection.thpp
28   )
29
30   if(ICINGA2_UNITY_BUILD)
31       mkunity_target(db_ido_pgsql db_ido_pgsql db_ido_pgsql_SOURCES)
32   endif()
33
34   add_library(db_ido_pgsql SHARED ${db_ido_pgsql_SOURCES})
35
36   target_link_libraries(db_ido_pgsql ${Boost_LIBRARIES} ${PostgreSQL_LIBRARIES} base config icinga db_ido)
37
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
42     FOLDER Components
43     VERSION ${SPEC_VERSION}
44   )
45
46   install_if_not_exists(
47     ${PROJECT_SOURCE_DIR}/etc/icinga2/features-available/ido-pgsql.conf
48     ${CMAKE_INSTALL_SYSCONFDIR}/icinga2/features-available
49   )
50
51   install(
52     TARGETS db_ido_pgsql
53     RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
54     LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
55   )
56
57   install(
58     DIRECTORY schema
59     DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2-ido-pgsql
60     FILES_MATCHING PATTERN "*.sql"
61   )
62
63   install(
64     DIRECTORY schema/upgrade
65     DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2-ido-pgsql/schema
66     FILES_MATCHING PATTERN "*.sql"
67   )
68
69   set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" PARENT_SCOPE)
70 else()
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.")
72 endif()