]> granicus.if.org Git - icinga2/blob - lib/db_ido_mysql/CMakeLists.txt
Fix a compiler warning
[icinga2] / lib / db_ido_mysql / 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(MySQL)
19
20 if(MYSQL_FOUND)
21     mkclass_target(idomysqlconnection.ti idomysqlconnection.thpp)
22
23     mkembedconfig_target(db_ido_mysql-type.conf db_ido_mysql-type.cpp)
24
25     set(db_ido_mysql_SOURCES
26       idomysqlconnection.cpp idomysqlconnection.thpp db_ido_mysql-type.cpp
27     )
28
29     if(ICINGA2_UNITY_BUILD)
30         mkunity_target(db_ido_mysql db_ido_mysql_SOURCES)
31     endif()
32
33     add_library(db_ido_mysql SHARED ${db_ido_mysql_SOURCES})
34
35     include_directories(${MYSQL_INCLUDE_DIR})
36     target_link_libraries(db_ido_mysql ${Boost_LIBRARIES} ${MYSQL_CLIENT_LIBS} base config icinga db_ido)
37
38     set_target_properties (
39       db_ido_mysql PROPERTIES
40       INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
41       FOLDER Components
42     )
43
44     install(
45       TARGETS db_ido_mysql
46       RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
47       LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
48     )
49
50     install(
51       DIRECTORY schema
52       DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2-ido-mysql
53       FILES_MATCHING PATTERN "*.sql"
54     )
55
56     install(
57       DIRECTORY schema/upgrade
58       DESTINATION ${CMAKE_INSTALL_DATADIR}/icinga2-ido-mysql/schema
59       FILES_MATCHING PATTERN "*.sql"
60     )
61 else()
62     message(FATAL_ERROR "You have selected MySQL support, but MySQL could not be found. You can disable the MySQL IDO module using -DICINGA2_WITH_MYSQL=OFF.")
63 endif()