]> granicus.if.org Git - icinga2/blob - plugins/CMakeLists.txt
Merge pull request #5921 from widhalmt/feature/director-check-in-itl-5920
[icinga2] / plugins / CMakeLists.txt
1 # Icinga 2
2 # Copyright (C) 2012-2018 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 add_executable ( check_nscp_api check_nscp_api.cpp  )
19 target_link_libraries ( check_nscp_api ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_SYSTEM_LIBRARY})
20 add_whole_static_library(check_nscp_api base)
21 add_whole_static_library(check_nscp_api config)
22 add_whole_static_library(check_nscp_api remote)
23 set_target_properties (
24   check_nscp_api PROPERTIES
25   INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
26   DEFINE_SYMBOL I2_PLUGINS_BUILD
27   FOLDER Plugins)
28
29 # Prefer the PluginDir constant which is set to /sbin on Windows
30
31 if(WIN32)
32     install(TARGETS check_nscp_api RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR})
33 else()
34     install(TARGETS check_nscp_api RUNTIME DESTINATION ${ICINGA2_PLUGINDIR})
35 endif()
36
37 if (WIN32)
38     add_definitions(-DUNICODE -D_UNICODE)
39
40     set(thresholds_SOURCES
41       thresholds.cpp thresholds.h
42     )
43
44     add_library(thresholds ${thresholds_SOURCES})
45
46     set_target_properties(
47       thresholds PROPERTIES
48       INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
49       FOLDER Plugins
50     )
51
52     set(check_SOURCES
53       check_disk.cpp check_load.cpp check_memory.cpp check_network.cpp check_perfmon.cpp
54       check_ping.cpp check_procs.cpp check_service.cpp check_swap.cpp check_update.cpp check_uptime.cpp
55       check_users.cpp
56     )
57
58   foreach(source ${check_SOURCES})
59     string(REGEX REPLACE ".cpp\$" "" check_OUT "${source}")
60     string(REGEX REPLACE ".cpp\$" ".h" check_HEADER "${source}")
61
62     add_executable(${check_OUT} ${source} ${check_HEADER})
63     target_link_libraries(${check_OUT} thresholds Shlwapi.lib ${Boost_PROGRAM_OPTIONS_LIBRARY})
64
65     set_target_properties(
66       ${check_OUT} PROPERTIES
67       INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
68       DEFINE_SYMBOL I2_PLUGINS_BUILD
69       FOLDER Plugins
70     )
71   endforeach()
72
73   target_link_libraries(check_load Pdh.lib)
74   target_link_libraries(check_network Pdh.lib Iphlpapi.lib)
75   target_link_libraries(check_perfmon Pdh.lib)
76   target_link_libraries(check_ping Ntdll.lib iphlpapi.lib Ws2_32.lib)
77   target_link_libraries(check_procs Pdh.lib)
78   target_link_libraries(check_uptime ${Boost_SYSTEM_LIBRARY})
79   target_link_libraries(check_users wtsapi32.lib)
80
81   install(
82     TARGETS check_disk check_load check_memory check_network check_perfmon check_procs
83       check_ping check_service check_swap check_update check_uptime check_users
84     RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
85   )
86 endif ( )