]> granicus.if.org Git - icinga2/blob - icinga-installer/CMakeLists.txt
Merge pull request #6704 from efuss/fix/scheduleddowntime1
[icinga2] / icinga-installer / CMakeLists.txt
1 # Icinga 2
2 # Copyright (C) 2012-2018 Icinga Development Team (https://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 foreach(flag_var
19   CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
20   CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
21   if(${flag_var} MATCHES "/MD")
22     string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
23   endif(${flag_var} MATCHES "/MD")
24 endforeach(flag_var)
25
26 set(icinga_installer_SOURCES
27   icinga-installer.cpp
28 )
29
30 add_executable(icinga-installer ${icinga_installer_SOURCES})
31
32 set_target_properties(
33   icinga-installer PROPERTIES
34   FOLDER Bin
35   OUTPUT_NAME icinga2-installer
36   LINK_FLAGS "/SUBSYSTEM:WINDOWS"
37 )
38
39 target_link_libraries(icinga-installer shlwapi)
40
41 install(CODE "
42   execute_process(COMMAND \${CMAKE_COMMAND} -E copy \"${CMAKE_CURRENT_BINARY_DIR}/icinga2.wixpatch.\${BUILD_TYPE}\"
43     \"${CMAKE_CURRENT_BINARY_DIR}/icinga2.wixpatch\"
44     RESULT_VARIABLE copy_result
45     ERROR_VARIABLE error_output)
46   if(copy_result)
47     message(FATAL_ERROR \${error_output})
48   endif()"
49 )
50
51 file(
52   GENERATE
53   OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/icinga2.wixpatch.$<CONFIG>"
54   INPUT "${CMAKE_CURRENT_SOURCE_DIR}/icinga2.wixpatch.cmake"
55 )
56
57 set(InstallPath "${CMAKE_INSTALL_SBINDIR}")
58
59 install(
60   TARGETS icinga-installer
61   RUNTIME DESTINATION ${InstallPath}
62 )