Skip to content

Commit

Permalink
Add cmake build files.
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarbeutner committed Nov 3, 2013
1 parent 2c143fb commit f2307c4
Show file tree
Hide file tree
Showing 84 changed files with 2,757 additions and 288 deletions.
49 changes: 2 additions & 47 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,47 +1,2 @@
*.sdf
*.opensdf
*.suo
*.lib
*.exe
*.pdb
Debug
Release
*.vcxproj.user
ipch
*.gcda
*.o
*.a
*.th
.deps
*.in
Makefile
*.log
*.la
*.lo
*~
aclocal.m4
autom4te.cache
config.guess
config.h
config.status
config.sub
configure
config/ylwrap
depcomp
icinga-version.h
install-sh
libtool
libtool.old
ltdl
ltmain.sh
missing
stamp-h1
.libs
icinga-app/icinga
docs/dev
m4/ylwrap
m4/test-driver
icinga2-*.tar.gz
icinga2.spec
packages
.vagrant
.vagrant
build
Empty file.
105 changes: 105 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Icinga 2
# Copyright (C) 2012-2013 Icinga Development Team (http://www.icinga.org/)
#
# 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)
project(icinga2)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

file(STRINGS icinga2.spec VERSION_LINE REGEX "^Version: ")
string(REPLACE "Version: " "" ICINGA2_VERSION ${VERSION_LINE})

set(ICINGA2_USER "icinga")
set(ICINGA2_GROUP "icinga")
set(ICINGA2_COMMAND_USER "icinga")
set(ICINGA2_COMMAND_GROUP "icingacmd")

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})

set(CPACK_PACKAGE_VERSION ${ICINGA2_VERSION})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
set(CPACK_WIX_UPGRADE_GUID "68C75073-7CEF-4FC9-8DA5-581758729696")
include(CPack)

include(GetGitRevisionDescription)
set(GIT_VERSION ${CPACK_PACKAGE_VERSION})
git_describe(GIT_VERSION --tags)
configure_file(icinga-version.h.cmake icinga-version.h)

if(WIN32)
set(Boost_USE_STATIC_LIBS ON)
add_definitions(-DBOOST_ALL_NO_LIB)
endif()

find_package(Boost 1.41.0 COMPONENTS thread system program_options REQUIRED)
link_directories(${Boost_LIBRARY_DIRS})
include_directories(${Boost_INCLUDE_DIRS})

find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})

include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR}/components
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/lib ${CMAKE_CURRENT_BINARY_DIR}/components
)

#set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)

if(APPLE)
set(CMAKE_INSTALL_NAME_DIR "@executable_path/../lib/icinga2")
endif(APPLE)

if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
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")

include(CheckFunctionExists)
check_function_exists(vfork HAVE_VFORK)
check_function_exists(backtrace_symbols HAVE_BACKTRACE_SYMBOLS)
check_function_exists(pipe2 HAVE_PIPE2)
check_function_exists(BIO_f_zlib HAVE_BIOZLIB)

include(GNUInstallDirs)
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)

install(
FILES README COPYING COPYING.Exceptions AUTHORS ChangeLog INSTALL NEWS
DESTINATION ${CMAKE_INSTALL_DOCDIR}
)

include(CTest)
enable_testing()

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

add_subdirectory(third-party)
add_subdirectory(tools)
add_subdirectory(lib)
add_subdirectory(components)
add_subdirectory(icinga-app)
add_subdirectory(etc)
add_subdirectory(itl)
add_subdirectory(doc)
add_subdirectory(test)
add_subdirectory(pki)
33 changes: 7 additions & 26 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,19 @@ The following requirements need to be fulfilled in order to build the
application using a dist tarball (package names for RHEL and Debian in
parentheses):

* cmake
* GNU make (make)
* C++ compiler (gcc-c++ on RHEL, build-essential on Debian)
* OpenSSL library and header files (openssl-devel on RHEL, libssl-dev
on Debian)
* Boost library and header files (boost-devel on RHEL, libboost-all-dev
on Debian)
* GNU bison (bison)
* GNU flex (flex)
* optional: Doxygen (doxygen)
* optional: MySQL (mysql-devel on RHEL, libmysqlclient-dev on Debian)
* optional: Python (python-devel on RHEL, python-dev on Debian)

Packaging Requirements
----------------------

In order to build a dist tarball for the application the following external
software components need to be installed in addition to the build requirements
mentioned above:

* GNU Automake (automake)
* GNU Autoconf (autoconf)
* GNU Libtool (libtool and libtool-ltdl-devel on RHEL, libtool and
libltdl-dev on Debian)
* GNU bison (bison)
* GNU flex (flex)

In order to build the dist tarball (using "make dist") you need sufficiently
recent versions of the packages listed above.

User Requirements
-----------------

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

$ ./configure
$ mkdir build && cd build
$ cmake ..
$ make
$ make install

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

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

Running Icinga 2
----------------
Expand Down
Loading

0 comments on commit f2307c4

Please sign in to comment.