]> granicus.if.org Git - icinga2/blobdiff - CMakeLists.txt
Fix a debug line being displayed in non-debug mode
[icinga2] / CMakeLists.txt
index efe3fb6ac5d6c5b335f7f4c7fc9f291d59e30b45..31636cfe0f69c6a4655c9bece7060db1da487608 100644 (file)
@@ -28,14 +28,24 @@ if(NOT CMAKE_BUILD_TYPE)
       FORCE)
 endif()
 
+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)
+
 file(STRINGS icinga2.spec VERSION_LINE REGEX "^Version: ")
 string(REPLACE "Version: " "" ICINGA2_VERSION ${VERSION_LINE})
 
 include(GNUInstallDirs)
+include(InstallConfig)
 
 set(ICINGA2_USER "icinga" CACHE STRING "Icinga 2 user")
 set(ICINGA2_GROUP "icinga" CACHE STRING "Icinga 2 group")
-set(ICINGA2_COMMAND_USER "icinga" CACHE STRING "Icinga 2 command user")
 set(ICINGA2_COMMAND_GROUP "icingacmd" CACHE STRING "Icinga 2 command group")
 set(ICINGA2_RUNDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run" CACHE STRING "/run directory")
 set(ICINGA2_PLUGINDIR "/usr/lib/nagios/plugins" CACHE STRING "Path for the check plugins")
@@ -81,6 +91,14 @@ include_directories(${Boost_INCLUDE_DIRS})
 find_package(OpenSSL REQUIRED)
 include_directories(${OPENSSL_INCLUDE_DIR})
 
+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()
+
 include_directories(
   ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib
   ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/lib
@@ -90,21 +108,22 @@ include_directories(
 
 if(APPLE)
   set(CMAKE_INSTALL_NAME_DIR "@executable_path/../lib/icinga2")
+  set(CMAKE_MACOSX_RPATH 0)
 endif(APPLE)
 
-if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
+if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -g")
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -g")
 endif()
 
-if("${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro")
+if(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mt")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mt -library=stlport4")
 endif()
 
-if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
-  if(${CMAKE_SYSTEM_NAME} MATCHES AIX)
+  if(CMAKE_SYSTEM_NAME MATCHES AIX)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -lpthread")
   else()
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
@@ -130,12 +149,17 @@ if(NOT HAVE_COUNTER_MACRO AND ICINGA2_UNITY_BUILD)
   set(ICINGA2_UNITY_BUILD FALSE)
 endif()
 
+set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DI2_DEBUG")
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DI2_DEBUG")
+
 check_function_exists(vfork HAVE_VFORK)
 check_function_exists(backtrace_symbols HAVE_BACKTRACE_SYMBOLS)
 check_function_exists(pipe2 HAVE_PIPE2)
 check_function_exists(nice HAVE_NICE)
 check_library_exists(dl dladdr "dlfcn.h" HAVE_DLADDR)
 check_library_exists(execinfo backtrace_symbols "" HAVE_LIBEXECINFO)
+check_library_exists(readline readline "" HAVE_LIBREADLINE)
+check_library_exists(ncurses attroff "" HAVE_LIBNCURSES)
 check_include_file_cxx(cxxabi.h HAVE_CXXABI_H)
 
 if(HAVE_LIBEXECINFO)
@@ -163,6 +187,7 @@ add_subdirectory(itl)
 add_subdirectory(doc)
 add_subdirectory(test)
 add_subdirectory(agent)
+add_subdirectory(plugins)
 
 set(CPACK_PACKAGE_NAME "Icinga2")
 set(CPACK_PACKAGE_VENDOR "Icinga Development Team")
@@ -186,7 +211,7 @@ include(InstallRequiredSystemLibraries)
 if(WIN32)
   install(
     PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}
-      C:\\\\openssl\\\\bin\\\\libeay32.dll C:\\\\openssl\\\\bin\\\\ssleay32.dll
+      ${OPENSSL_INCLUDE_DIR}/../bin/libeay32.dll ${OPENSSL_INCLUDE_DIR}/../bin/ssleay32.dll
     DESTINATION ${CMAKE_INSTALL_SBINDIR}
   )
 endif()