Skip to content

Commit f2307c4

Browse files
committed
Add cmake build files.
Refs #4962
1 parent 2c143fb commit f2307c4

File tree

84 files changed

+2757
-288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2757
-288
lines changed

.gitignore

+2-47
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,2 @@
1-
*.sdf
2-
*.opensdf
3-
*.suo
4-
*.lib
5-
*.exe
6-
*.pdb
7-
Debug
8-
Release
9-
*.vcxproj.user
10-
ipch
11-
*.gcda
12-
*.o
13-
*.a
14-
*.th
15-
.deps
16-
*.in
17-
Makefile
18-
*.log
19-
*.la
20-
*.lo
21-
*~
22-
aclocal.m4
23-
autom4te.cache
24-
config.guess
25-
config.h
26-
config.status
27-
config.sub
28-
configure
29-
config/ylwrap
30-
depcomp
31-
icinga-version.h
32-
install-sh
33-
libtool
34-
libtool.old
35-
ltdl
36-
ltmain.sh
37-
missing
38-
stamp-h1
39-
.libs
40-
icinga-app/icinga
41-
docs/dev
42-
m4/ylwrap
43-
m4/test-driver
44-
icinga2-*.tar.gz
45-
icinga2.spec
46-
packages
47-
.vagrant
1+
.vagrant
2+
build

.vagrant-puppet/files/usr/local/bin/.gitignore

Whitespace-only changes.

CMakeLists.txt

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Icinga 2
2+
# Copyright (C) 2012-2013 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+
cmake_minimum_required(VERSION 2.6)
19+
project(icinga2)
20+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
21+
22+
file(STRINGS icinga2.spec VERSION_LINE REGEX "^Version: ")
23+
string(REPLACE "Version: " "" ICINGA2_VERSION ${VERSION_LINE})
24+
25+
set(ICINGA2_USER "icinga")
26+
set(ICINGA2_GROUP "icinga")
27+
set(ICINGA2_COMMAND_USER "icinga")
28+
set(ICINGA2_COMMAND_GROUP "icingacmd")
29+
30+
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING" ICINGA2_LICENSE_GPL)
31+
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.Exceptions" ICINGA2_LICENSE_ADDITIONS)
32+
set(ICINGA2_LICENSE "${ICINGA2_LICENSE_GPL}\n\n---\n\n${ICINGA2_LICENSE_ADDITIONS}")
33+
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" ${ICINGA2_LICENSE})
34+
35+
set(CPACK_PACKAGE_VERSION ${ICINGA2_VERSION})
36+
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
37+
set(CPACK_WIX_UPGRADE_GUID "68C75073-7CEF-4FC9-8DA5-581758729696")
38+
include(CPack)
39+
40+
include(GetGitRevisionDescription)
41+
set(GIT_VERSION ${CPACK_PACKAGE_VERSION})
42+
git_describe(GIT_VERSION --tags)
43+
configure_file(icinga-version.h.cmake icinga-version.h)
44+
45+
if(WIN32)
46+
set(Boost_USE_STATIC_LIBS ON)
47+
add_definitions(-DBOOST_ALL_NO_LIB)
48+
endif()
49+
50+
find_package(Boost 1.41.0 COMPONENTS thread system program_options REQUIRED)
51+
link_directories(${Boost_LIBRARY_DIRS})
52+
include_directories(${Boost_INCLUDE_DIRS})
53+
54+
find_package(OpenSSL REQUIRED)
55+
include_directories(${OPENSSL_INCLUDE_DIR})
56+
57+
include_directories(
58+
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}/components
59+
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/lib ${CMAKE_CURRENT_BINARY_DIR}/components
60+
)
61+
62+
#set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
63+
64+
if(APPLE)
65+
set(CMAKE_INSTALL_NAME_DIR "@executable_path/../lib/icinga2")
66+
endif(APPLE)
67+
68+
if(MSVC)
69+
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
70+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
71+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
72+
endif()
73+
74+
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/Bin/${CMAKE_BUILD_TYPE} CACHE PATH "Library output path")
75+
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/Bin/${CMAKE_BUILD_TYPE} CACHE PATH "Executable output path")
76+
77+
include(CheckFunctionExists)
78+
check_function_exists(vfork HAVE_VFORK)
79+
check_function_exists(backtrace_symbols HAVE_BACKTRACE_SYMBOLS)
80+
check_function_exists(pipe2 HAVE_PIPE2)
81+
check_function_exists(BIO_f_zlib HAVE_BIOZLIB)
82+
83+
include(GNUInstallDirs)
84+
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
85+
86+
install(
87+
FILES README COPYING COPYING.Exceptions AUTHORS ChangeLog INSTALL NEWS
88+
DESTINATION ${CMAKE_INSTALL_DOCDIR}
89+
)
90+
91+
include(CTest)
92+
enable_testing()
93+
94+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
95+
96+
add_subdirectory(third-party)
97+
add_subdirectory(tools)
98+
add_subdirectory(lib)
99+
add_subdirectory(components)
100+
add_subdirectory(icinga-app)
101+
add_subdirectory(etc)
102+
add_subdirectory(itl)
103+
add_subdirectory(doc)
104+
add_subdirectory(test)
105+
add_subdirectory(pki)

INSTALL

+7-26
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,19 @@ The following requirements need to be fulfilled in order to build the
1818
application using a dist tarball (package names for RHEL and Debian in
1919
parentheses):
2020

21+
* cmake
2122
* GNU make (make)
2223
* C++ compiler (gcc-c++ on RHEL, build-essential on Debian)
2324
* OpenSSL library and header files (openssl-devel on RHEL, libssl-dev
2425
on Debian)
2526
* Boost library and header files (boost-devel on RHEL, libboost-all-dev
2627
on Debian)
28+
* GNU bison (bison)
29+
* GNU flex (flex)
2730
* optional: Doxygen (doxygen)
2831
* optional: MySQL (mysql-devel on RHEL, libmysqlclient-dev on Debian)
2932
* optional: Python (python-devel on RHEL, python-dev on Debian)
3033

31-
Packaging Requirements
32-
----------------------
33-
34-
In order to build a dist tarball for the application the following external
35-
software components need to be installed in addition to the build requirements
36-
mentioned above:
37-
38-
* GNU Automake (automake)
39-
* GNU Autoconf (autoconf)
40-
* GNU Libtool (libtool and libtool-ltdl-devel on RHEL, libtool and
41-
libltdl-dev on Debian)
42-
* GNU bison (bison)
43-
* GNU flex (flex)
44-
45-
In order to build the dist tarball (using "make dist") you need sufficiently
46-
recent versions of the packages listed above.
47-
4834
User Requirements
4935
-----------------
5036

@@ -72,19 +58,14 @@ Building Icinga 2
7258
Once you have installed all the necessary build requirements you can build
7359
Icinga 2 using the following commands:
7460

75-
$ ./configure
61+
$ mkdir build && cd build
62+
$ cmake ..
7663
$ make
7764
$ make install
7865

79-
The configure script supports all the usual parameters one comes to expect
80-
from autoconf. In particular you may want to use --prefix to specify an
81-
alternative installation prefix.
66+
You can specify an alternative installation prefix using -DCMAKE_INSTALL_PREFIX:
8267

83-
Note: The Git repository does not contain any auto-generated Autotools files,
84-
i.e. there is no 'configure' script. In this case you will need to regenerate
85-
the 'configure' script by running 'autogen.sh'. However, as an end-user you
86-
should reconsider whether you really want to use the code from the Git
87-
repository. In general it is advisable to use one of the dist tarballs instead.
68+
$ cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/icinga2
8869

8970
Running Icinga 2
9071
----------------

0 commit comments

Comments
 (0)