2013-11-03 13:45:26 +01:00
# Icinga 2
2017-01-10 15:54:22 +01:00
# Copyright (C) 2012-2017 Icinga Development Team (https://www.icinga.com/)
2013-11-03 13:45:26 +01:00
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
cmake_minimum_required ( VERSION 2.6 )
2017-11-07 13:20:25 +01:00
set ( BOOST_MIN_VERSION "1.48.0" )
2013-12-18 12:54:49 +01:00
2013-11-03 13:45:26 +01:00
project ( icinga2 )
2014-06-23 10:56:12 +02:00
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" )
2014-06-15 02:17:01 +02:00
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third-party/cmake" )
2013-11-03 13:45:26 +01:00
2013-11-20 16:36:11 +01:00
if ( NOT CMAKE_BUILD_TYPE )
2013-11-30 13:47:51 +01:00
set ( CMAKE_BUILD_TYPE Release CACHE STRING
2013-11-20 16:36:11 +01:00
" C h o o s e t h e t y p e o f b u i l d , o p t i o n s a r e : N o n e D e b u g R e l e a s e R e l W i t h D e b I n f o M i n S i z e R e l . "
F O R C E )
endif ( )
2014-12-19 09:45:35 +01:00
option ( ICINGA2_WITH_MYSQL "Build the MySQL IDO module" ON )
option ( ICINGA2_WITH_PGSQL "Build the PostgreSQL IDO module" ON )
option ( ICINGA2_WITH_CHECKER "Build the checker module" ON )
option ( ICINGA2_WITH_COMPAT "Build the compat module" ON )
option ( ICINGA2_WITH_DEMO "Build the demo module" OFF )
option ( ICINGA2_WITH_HELLO "Build the hello module" OFF )
option ( ICINGA2_WITH_LIVESTATUS "Build the Livestatus module" ON )
option ( ICINGA2_WITH_NOTIFICATION "Build the notification module" ON )
option ( ICINGA2_WITH_PERFDATA "Build the perfdata module" ON )
2015-08-29 01:16:16 +02:00
option ( ICINGA2_WITH_STUDIO "Build the Icinga Studio application" OFF )
2015-11-25 15:24:04 +01:00
option ( ICINGA2_WITH_TESTS "Run unit tests" ON )
2014-11-13 22:37:12 +01:00
2013-11-03 13:45:26 +01:00
file ( STRINGS icinga2.spec VERSION_LINE REGEX "^Version: " )
string ( REPLACE "Version: " "" ICINGA2_VERSION ${ VERSION_LINE } )
2014-07-22 13:18:41 +02:00
include ( GNUInstallDirs )
2014-12-19 09:51:14 +01:00
include ( InstallConfig )
2014-07-22 13:18:41 +02:00
2013-12-05 09:42:42 +01:00
set ( ICINGA2_USER "icinga" CACHE STRING "Icinga 2 user" )
set ( ICINGA2_GROUP "icinga" CACHE STRING "Icinga 2 group" )
set ( ICINGA2_COMMAND_GROUP "icingacmd" CACHE STRING "Icinga 2 command group" )
2014-07-22 13:18:41 +02:00
set ( ICINGA2_RUNDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run" CACHE STRING "/run directory" )
2014-07-22 13:22:39 +02:00
set ( ICINGA2_PLUGINDIR "/usr/lib/nagios/plugins" CACHE STRING "Path for the check plugins" )
2014-05-18 14:33:38 +02:00
set ( ICINGA2_GIT_VERSION_INFO ON CACHE BOOL "Whether to use git describe" )
2015-03-01 01:27:42 +01:00
set ( ICINGA2_UNITY_BUILD ON CACHE BOOL "Whether to perform a unity build" )
2015-03-04 08:57:20 +01:00
set ( ICINGA2_LTO_BUILD OFF CACHE BOOL "Whether to use LTO" )
2013-11-03 13:45:26 +01:00
2016-08-10 08:03:54 +02:00
site_name ( ICINGA2_BUILD_HOST_NAME )
set ( ICINGA2_BUILD_COMPILER_NAME "${CMAKE_CXX_COMPILER_ID}" )
if ( NOT CMAKE_CXX_COMPILER_VERSION )
execute_process ( COMMAND ${ CMAKE_CXX_COMPILER } -dumpversion
2016-08-10 08:22:17 +02:00
O U T P U T _ V A R I A B L E C M A K E _ C X X _ C O M P I L E R _ V E R S I O N O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
2016-08-10 08:03:54 +02:00
endif ( )
set ( ICINGA2_BUILD_COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION}" )
2013-11-03 13:45:26 +01:00
file ( READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING" ICINGA2_LICENSE_GPL )
file ( READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.Exceptions" ICINGA2_LICENSE_ADDITIONS )
set ( ICINGA2_LICENSE "${ICINGA2_LICENSE_GPL}\n\n---\n\n${ICINGA2_LICENSE_ADDITIONS}" )
file ( WRITE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" ${ ICINGA2_LICENSE } )
2016-08-25 17:32:20 +02:00
file ( STRINGS icinga2.spec SPEC_VERSION REGEX "^Version:" )
string ( LENGTH "${SPEC_VERSION}" SPEC_VERSION_LENGTH )
math ( EXPR SPEC_VERSION_LENGTH "${SPEC_VERSION_LENGTH} - 9" )
string ( SUBSTRING ${ SPEC_VERSION } 9 ${ SPEC_VERSION_LENGTH } SPEC_VERSION )
configure_file ( icinga-spec-version.h.cmake icinga-spec-version.h )
2013-11-03 13:45:26 +01:00
include ( GetGitRevisionDescription )
git_describe ( GIT_VERSION --tags )
2014-05-18 14:19:16 +02:00
if ( EXISTS ${ CMAKE_CURRENT_SOURCE_DIR } /icinga-version.h.force )
configure_file ( icinga-version.h.force ${ CMAKE_CURRENT_BINARY_DIR } /icinga-version.h COPYONLY )
2013-11-27 10:35:48 +01:00
else ( )
2014-05-18 14:33:38 +02:00
if ( NOT ICINGA2_GIT_VERSION_INFO OR GIT_VERSION MATCHES "-NOTFOUND$" )
2014-05-21 10:29:44 +02:00
file ( STRINGS icinga2.spec SPEC_REVISION REGEX "^%define revision " )
string ( LENGTH "${SPEC_REVISION}" SPEC_REVISION_LENGTH )
math ( EXPR SPEC_REVISION_LENGTH "${SPEC_REVISION_LENGTH} - 17" )
string ( SUBSTRING ${ SPEC_REVISION } 17 ${ SPEC_REVISION_LENGTH } SPEC_REVISION )
set ( GIT_VERSION "r${SPEC_VERSION}-${SPEC_REVISION}" )
2014-05-18 14:19:16 +02:00
endif ( )
2013-11-27 10:35:48 +01:00
configure_file ( icinga-version.h.cmake icinga-version.h )
endif ( )
2013-11-03 13:45:26 +01:00
if ( WIN32 )
set ( Boost_USE_STATIC_LIBS ON )
add_definitions ( -DBOOST_ALL_NO_LIB )
2016-03-29 08:45:46 +02:00
add_definitions ( /bigobj )
2013-11-03 13:45:26 +01:00
endif ( )
2016-03-26 14:41:58 +01:00
if ( NOT DEFINED LOGROTATE_HAS_SU )
set ( LOGROTATE_HAS_SU OFF )
2016-08-23 00:59:24 +02:00
find_program ( LOGROTATE_BINARY logrotate )
execute_process ( COMMAND ${ LOGROTATE_BINARY } ERROR_VARIABLE LOGROTATE_OUTPUT )
2016-03-26 14:41:58 +01:00
if ( LOGROTATE_OUTPUT )
string ( REGEX REPLACE "^logrotate ([0-9.]*).*" "\\1" LOGROTATE_VERSION
$ { L O G R O T A T E _ O U T P U T } )
message ( STATUS "Found logrotate (found version \" ${ LOGROTATE_VERSION } \")")
if ( "${LOGROTATE_VERSION}" VERSION_GREATER "3.7.9" )
set ( LOGROTATE_HAS_SU ON )
endif ( )
endif ( )
endif ( )
if ( LOGROTATE_HAS_SU )
set ( LOGROTATE_USE_SU "\n\tsu ${ICINGA2_USER} ${ICINGA2_GROUP}" )
endif ( )
2013-12-18 12:54:49 +01:00
find_package ( Boost ${ BOOST_MIN_VERSION } COMPONENTS thread system program_options regex REQUIRED )
2013-11-03 13:45:26 +01:00
link_directories ( ${ Boost_LIBRARY_DIRS } )
include_directories ( ${ Boost_INCLUDE_DIRS } )
find_package ( OpenSSL REQUIRED )
include_directories ( ${ OPENSSL_INCLUDE_DIR } )
2014-10-27 12:42:57 +01:00
find_package ( YAJL )
if ( NOT YAJL_FOUND )
include_directories ( ${ icinga2_BINARY_DIR } /third-party/yajl/include )
link_directories ( ${ icinga2_BINARY_DIR } /third-party/yajl )
set ( YAJL_LIBRARIES "yajl" )
endif ( )
2015-03-17 10:42:46 +01:00
find_package ( Editline )
set ( HAVE_EDITLINE "${EDITLINE_FOUND}" )
find_package ( Termcap )
set ( HAVE_TERMCAP "${TERMCAP_FOUND}" )
2013-11-03 13:45:26 +01:00
include_directories (
2014-10-13 09:51:49 +02:00
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / l i b
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / l i b
2013-11-03 13:45:26 +01:00
)
2016-08-28 17:19:20 +02:00
set ( CMAKE_MACOSX_RPATH 1 )
2013-11-03 13:45:26 +01:00
2015-07-14 15:02:43 +02:00
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
2013-11-30 13:47:51 +01:00
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -g" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -g" )
2017-09-27 20:04:43 +02:00
# Clang on Fedora requires -pthread, Apple Clang does not
# AppleClang is available since CMake 3.0.0
if ( NOT CMAKE_CXX_COMPILER_ID MATCHES "AppleClang" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread" )
endif ( )
2013-11-30 13:47:51 +01:00
endif ( )
2014-12-04 22:02:44 +01:00
if ( CMAKE_C_COMPILER_ID STREQUAL "SunPro" )
2014-09-03 08:24:14 +02:00
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mt" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mt -library=stlport4" )
endif ( )
2014-12-04 22:02:44 +01:00
if ( CMAKE_C_COMPILER_ID STREQUAL "GNU" )
if ( CMAKE_SYSTEM_NAME MATCHES AIX )
2015-02-13 11:21:20 +01:00
set ( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -g -lpthread" )
2014-04-16 15:08:47 +02:00
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -lpthread" )
2015-02-13 11:21:20 +01:00
elseif ( CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -pthread" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pthread" )
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpthread" )
2015-03-01 15:29:57 +01:00
set ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lpthread" )
2014-04-16 15:08:47 +02:00
else ( )
2016-02-16 13:08:21 +01:00
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -pthread" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pthread" )
2014-04-16 15:08:47 +02:00
endif ( )
2015-03-01 15:29:57 +01:00
2015-10-26 22:01:22 +01:00
if ( NOT CMAKE_SYSTEM_NAME MATCHES AIX AND NOT CMAKE_SYSTEM_NAME MATCHES OpenBSD AND NOT CMAKE_SYSTEM_NAME MATCHES SunOS )
2015-07-01 08:48:42 +02:00
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -Wl,--no-export-dynamic -Bsymbolic-functions -Wl,--dynamic-list-cpp-typeinfo -Wl,--dynamic-list-data" )
set ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--no-export-dynamic -Bsymbolic-functions -Wl,--dynamic-list-cpp-typeinfo -Wl,--dynamic-list-data" )
endif ( )
2013-11-05 07:32:11 +01:00
endif ( )
2016-08-27 21:42:05 +02:00
include ( CheckCXXCompilerFlag )
2015-03-04 08:57:20 +01:00
if ( ICINGA2_LTO_BUILD )
2016-08-27 21:42:05 +02:00
check_cxx_compiler_flag ( "-flto" CXX_FLAG_LTO )
if ( NOT CXX_FLAG_LTO )
message ( WARNING "Compiler does not support LTO, falling back to non-LTO build" )
else ( )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto" )
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto" )
set ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto" )
endif ( )
2015-03-04 08:57:20 +01:00
endif ( )
2015-03-09 09:49:55 +01:00
include ( CheckCCompilerFlag )
check_c_compiler_flag ( -fvisibility-inlines-hidden HAVE_VISIBILITY_INLINES_HIDDEN )
if ( HAVE_VISIBILITY_INLINES_HIDDEN )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility-inlines-hidden" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden" )
endif ( )
2016-08-25 05:05:51 +02:00
check_c_compiler_flag ( -fvisibility=hidden HAVE_VISIBILITY_HIDDEN )
if ( HAVE_VISIBILITY_HIDDEN )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden" )
endif ( )
2013-11-03 13:45:26 +01:00
if ( MSVC )
add_definitions ( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS )
endif ( )
set ( LIBRARY_OUTPUT_PATH ${ CMAKE_BINARY_DIR } /Bin/ ${ CMAKE_BUILD_TYPE } CACHE PATH "Library output path" )
set ( EXECUTABLE_OUTPUT_PATH ${ CMAKE_BINARY_DIR } /Bin/ ${ CMAKE_BUILD_TYPE } CACHE PATH "Executable output path" )
2014-08-31 11:01:37 +02:00
include ( CheckSymbolExists )
2013-11-03 13:45:26 +01:00
include ( CheckFunctionExists )
2013-11-13 11:55:44 +01:00
include ( CheckLibraryExists )
2014-09-02 13:02:22 +02:00
include ( CheckIncludeFileCXX )
2014-08-31 11:01:37 +02:00
check_symbol_exists ( __COUNTER__ "" HAVE_COUNTER_MACRO )
2016-08-27 09:35:08 +02:00
if ( NOT HAVE_COUNTER_MACRO )
message ( FATAL_ERROR "Your C/C++ compiler does not support the __COUNTER__ macro." )
2014-08-31 11:01:37 +02:00
endif ( )
2014-12-19 12:19:28 +01:00
set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DI2_DEBUG" )
set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DI2_DEBUG" )
2014-11-12 11:34:59 +01:00
2013-11-03 13:45:26 +01:00
check_function_exists ( vfork HAVE_VFORK )
check_function_exists ( backtrace_symbols HAVE_BACKTRACE_SYMBOLS )
check_function_exists ( pipe2 HAVE_PIPE2 )
2014-09-06 02:20:25 +02:00
check_function_exists ( nice HAVE_NICE )
2014-03-06 12:16:00 +01:00
check_library_exists ( dl dladdr "dlfcn.h" HAVE_DLADDR )
2014-04-14 03:02:33 +02:00
check_library_exists ( execinfo backtrace_symbols "" HAVE_LIBEXECINFO )
2014-09-02 13:02:22 +02:00
check_include_file_cxx ( cxxabi.h HAVE_CXXABI_H )
2014-04-14 03:02:33 +02:00
if ( HAVE_LIBEXECINFO )
set ( HAVE_BACKTRACE_SYMBOLS TRUE )
endif ( )
2013-11-03 13:45:26 +01:00
2016-08-25 05:14:13 +02:00
if ( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
exec_program ( ${ CMAKE_CXX_COMPILER }
A R G S - d u m p v e r s i o n
O U T P U T _ V A R I A B L E _ I C I N G A 2 _ C O M P I L E R _ V E R S I O N
)
2015-11-30 08:16:39 +01:00
2017-05-05 12:46:56 +02:00
if ( "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.7.0" )
message ( FATAL_ERROR "Your version of GCC (${CMAKE_CXX_COMPILER_VERSION}) is too old for building Icinga 2 (GCC >= 4.7.0 is required)." )
2015-03-23 07:55:06 +01:00
endif ( )
endif ( )
2016-01-11 14:28:58 +01:00
if ( NOT MSVC )
2016-08-25 05:14:13 +02:00
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x" )
2015-11-30 08:16:39 +01:00
2016-08-25 05:14:13 +02:00
check_cxx_source_compiles ( "class Base { public: virtual void test(void) { } }; class Derived : public Base { virtual void test(void) override { } }; int main(){}" CXX_FEATURE_OVERRIDE )
2015-03-23 07:55:06 +01:00
2016-01-11 14:28:58 +01:00
if ( NOT CXX_FEATURE_OVERRIDE )
add_definitions ( "-Doverride=" )
endif ( )
2015-03-23 07:55:06 +01:00
endif ( )
2013-11-15 09:04:39 +01:00
configure_file ( config.h.cmake ${ CMAKE_CURRENT_BINARY_DIR } /config.h ESCAPE_QUOTES )
2013-11-03 13:45:26 +01:00
install (
2017-06-20 19:44:42 +02:00
F I L E S R E A D M E . m d C O P Y I N G C O P Y I N G . E x c e p t i o n s A U T H O R S C H A N G E L O G . m d N E W S
2013-11-03 13:45:26 +01:00
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ D O C D I R }
)
include ( CTest )
enable_testing ( )
set_property ( GLOBAL PROPERTY USE_FOLDERS ON )
add_subdirectory ( third-party )
add_subdirectory ( tools )
add_subdirectory ( lib )
add_subdirectory ( icinga-app )
add_subdirectory ( etc )
add_subdirectory ( itl )
add_subdirectory ( doc )
2014-09-17 11:25:34 +02:00
add_subdirectory ( agent )
2014-11-06 15:17:08 +01:00
add_subdirectory ( plugins )
2016-08-31 13:41:13 +02:00
add_subdirectory ( choco )
2014-04-20 11:22:15 +02:00
2016-03-30 18:59:23 +02:00
if ( MSVC )
add_subdirectory ( icinga-installer )
endif ( )
2015-08-29 01:16:16 +02:00
if ( ICINGA2_WITH_STUDIO )
add_subdirectory ( icinga-studio )
endif ( )
2015-11-25 15:24:04 +01:00
if ( ICINGA2_WITH_TESTS )
add_subdirectory ( test )
endif ( )
2016-03-30 11:47:39 +02:00
set ( CPACK_PACKAGE_NAME "Icinga 2" )
2014-04-20 11:22:15 +02:00
set ( CPACK_PACKAGE_VENDOR "Icinga Development Team" )
set ( CPACK_PACKAGE_VERSION ${ ICINGA2_VERSION } )
set ( CPACK_PACKAGE_INSTALL_DIRECTORY "ICINGA2" )
set ( CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icinga-app\\\\icinga.ico" )
set ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" )
2015-08-31 08:35:24 +02:00
set ( CPACK_PACKAGE_EXECUTABLES "Icinga2SetupAgent;Icinga 2 Agent Wizard;icinga-studio;Icinga Studio" )
2016-03-30 11:47:39 +02:00
set ( CPACK_WIX_PRODUCT_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icinga-app\\\\icinga.ico" )
set ( CPACK_WIX_UPGRADE_GUID "52F2BEAA-4DF0-4C3E-ABDC-C0F61DE4DF8A" )
2016-03-31 10:25:44 +02:00
set ( CPACK_WIX_EXTENSIONS "WixUtilExtension" )
2016-04-14 08:38:57 +02:00
set ( CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/icinga-installer/bannrbmp.bmp" )
set ( CPACK_WIX_UI_DIALOG "${CMAKE_CURRENT_SOURCE_DIR}/icinga-installer/dlgbmp.bmp" )
2016-04-14 14:58:13 +02:00
set ( CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_BINARY_DIR}/icinga-installer/icinga2.wixpatch.Debug" )
set ( CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_BINARY_DIR}/icinga-installer/icinga2.wixpatch" )
2014-04-20 11:22:15 +02:00
set ( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE )
include ( InstallRequiredSystemLibraries )
if ( WIN32 )
2016-03-30 09:47:45 +02:00
if ( CMAKE_VS_PLATFORM_NAME STREQUAL "x64" )
2016-09-21 14:04:20 +02:00
set ( NSCP_URL "https://github.com/mickem/nscp/releases/download/0.5.0.62/NSCP-0.5.0.62-x64.msi" )
set ( NSCP_SHA256 "1854de86ad4fda3391f273de0f9985b702c014bdec01b26ad28a1343177f537f" )
2016-03-30 09:47:45 +02:00
else ( )
2016-09-21 14:04:20 +02:00
set ( NSCP_URL "https://github.com/mickem/nscp/releases/download/0.5.0.62/NSCP-0.5.0.62-Win32.msi" )
set ( NSCP_SHA256 "2186b60d588fa0811344ce709332f9c63670019c62ae92eae49698bf76205a95" )
2016-03-30 09:47:45 +02:00
endif ( )
2015-08-18 20:16:22 +02:00
set ( NSCP_SHA256SUM "" )
2016-03-30 09:47:45 +02:00
if ( EXISTS ${ CMAKE_CURRENT_BINARY_DIR } /NSCP.msi )
file ( SHA256 ${ CMAKE_CURRENT_BINARY_DIR } /NSCP.msi NSCP_SHA256SUM )
2015-08-18 20:16:22 +02:00
endif ( )
2017-04-05 17:51:20 +02:00
2016-03-30 09:47:45 +02:00
if ( NOT EXISTS ${ CMAKE_CURRENT_BINARY_DIR } /NSCP.msi OR NOT ${ NSCP_SHA256SUM } STREQUAL ${ NSCP_SHA256 } )
file ( DOWNLOAD ${ NSCP_URL } ${ CMAKE_CURRENT_BINARY_DIR } /NSCP.msi SHOW_PROGRESS )
2015-08-18 20:16:22 +02:00
endif ( )
2016-03-30 09:47:45 +02:00
install ( FILES ${ CMAKE_CURRENT_BINARY_DIR } /NSCP.msi DESTINATION ${ CMAKE_INSTALL_SBINDIR } )
2015-06-15 11:19:18 +02:00
2017-04-06 12:58:05 +02:00
if ( OPENSSL_VERSION_MINOR GREATER_EQUAL 1 )
if ( CMAKE_VS_PLATFORM_NAME STREQUAL "x64" )
list ( APPEND ICINGA2_OPENSSL_DLLS ${ OPENSSL_INCLUDE_DIR } /../bin/libcrypto-1_1-x64.dll ${ OPENSSL_INCLUDE_DIR } /../bin/libssl-1_1-x64.dll )
else ( )
list ( APPEND ICINGA2_OPENSSL_DLLS ${ OPENSSL_INCLUDE_DIR } /../bin/libcrypto-1_1.dll ${ OPENSSL_INCLUDE_DIR } /../bin/libssl-1_1.dll )
endif ( )
else ( )
list ( APPEND ICINGA2_OPENSSL_DLLS ${ OPENSSL_INCLUDE_DIR } /../bin/libeay32.dll ${ OPENSSL_INCLUDE_DIR } /../bin/ssleay32.dll )
endif ( )
install (
P R O G R A M S $ { C M A K E _ I N S T A L L _ S Y S T E M _ R U N T I M E _ L I B S }
$ { I C I N G A 2 _ O P E N S S L _ D L L S }
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ S B I N D I R }
)
2014-04-20 11:22:15 +02:00
endif ( )
2014-05-09 10:23:54 +02:00
include ( CPack )