]> granicus.if.org Git - icinga2/blob - lib/db_ido_pgsql/CMakeLists.txt
Merge branch 'larsengels-master'
[icinga2] / lib / db_ido_pgsql / CMakeLists.txt
1 # Icinga 2
2 # Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org)
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.thpp)
22
23     mkembedconfig_target(db_ido_pgsql-type.conf db_ido_pgsql-type.cpp)
24
25     link_directories(${PostgreSQL_LIBRARY_DIRS})
26     include_directories(${PostgreSQL_INCLUDE_DIRS})
27
28     set(db_ido_pgsql_SOURCES
29       idopgsqlconnection.cpp idopgsqlconnection.thpp db_ido_pgsql-type.cpp
30     )
31
32     if(ICINGA2_UNITY_BUILD)
33         mkunity_target(db_ido_pgsql db_ido_pgsql_SOURCES)
34     endif()
35
36     add_library(db_ido_pgsql SHARED ${db_ido_pgsql_SOURCES})
37
38     target_link_libraries(db_ido_pgsql ${Boost_LIBRARIES} ${PostgreSQL_LIBRARIES} base config icinga db_ido)
39
40     set_target_properties (
41       db_ido_pgsql PROPERTIES
42       INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
43       FOLDER Components
44     )
45
46     install(
47       TARGETS db_ido_pgsql
48       RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
49       LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
50     )
51
52     install(
53       DIRECTORY schema
54       DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2-ido-pgsql
55       FILES_MATCHING PATTERN "*.sql"
56     )
57
58     install(
59       DIRECTORY schema/upgrade
60       DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2-ido-pgsql/schema
61       FILES_MATCHING PATTERN "*.sql"
62     )
63 else()
64     message( FATAL_ERROR "You have selected PostgreSQL support, but PostgreSQL could not be found." )
65 endif()