Fix includes
[quassel.git] / CMakeLists.txt
index 319d637..63d5f5f 100644 (file)
@@ -11,7 +11,7 @@
 # -DWITH_KDE=ON          : Enable KDE4 support
 # -DWITH_CRYPT=OFF       : Disable encryption support
 # -DWITH_OXYGEN=(ON|OFF) : Whether to install Oxygen icons (default: yes, unless KDE > 4.3.0 is present and enabled)
-# -DWITH_SYSLOG=OFF       : Use syslog for logging
+# -DWITH_SYSLOG=OFF      : Disable syslog support
 #
 # -DEMBED_DATA=ON        : Embed all data files in icons the binary, rather than installing them separately
 #
@@ -23,6 +23,9 @@
 
 project(QuasselIRC)
 
+include(CheckFunctionExists)
+include(CheckIncludeFile)
+
 # cmake 2.6.2 is required for KDE >=4.2 and should be widespread enough now
 cmake_minimum_required(VERSION 2.6.2 FATAL_ERROR)
 
@@ -47,7 +50,7 @@ option(WITH_PHONON   "Enable Phonon support (for audio notifications)"        ON)
 option(WITH_LIBINDICATE "Enable Ayatana notification support"           ON)
 option(WITH_KDE      "Enable KDE4 integration"                         OFF)
 option(WITH_CRYPT    "Enable encryption support if present on system"  ON)
-option(WITH_SYSLOG    "Use syslog for storing log data"          OFF)
+option(WITH_SYSLOG   "Use syslog for storing log data"                 ON)
 
 # We use icon paths from KDE 4.3.x, which are partially invalid on older and possibly
 # even on newer KDE versions. Do not disable this unless you are sure that your Quassel will
@@ -60,10 +63,6 @@ if(APPLE)
   option(DEPLOY        "Mac OS X only! Adds required libs to bundle resources and create a dmg. Note: requires Qt to be built with 10.4u SDK" OFF)
 endif(APPLE)
 
-if(WITH_SYSLOG)
-  check_include_file(syslog.h HAVE_SYSLOG_H)
-endif(WITH_SYSLOG)
-
 # Default to embedding data in the static case
 if(STATIC OR WIN32)
   set(EMBED_DEFAULT ON)
@@ -321,6 +320,20 @@ if(BUILD_CORE)
     message(STATUS "Not enabling encryption support")
   endif(WITH_CRYPT)
 
+  # Setup syslog support
+  if(WITH_SYSLOG)
+    check_include_file(syslog.h HAVE_SYSLOG_H)
+    if(HAVE_SYSLOG_H)
+      message(STATUS "Enabling syslog support")
+      set(HAVE_SYSLOG true)
+      add_definitions(-DHAVE_SYSLOG)
+    else(HAVE_SYSLOG_H)
+      message(STATUS "Disabling syslog support")
+    endif(HAVE_SYSLOG_H)
+  else(WITH_SYSLOG)
+    message(STATUS "Not enabling syslog support")
+  endif(WITH_SYSLOG)
+
 endif(BUILD_CORE)
 
 # needed to compile with mingw without kde
@@ -372,8 +385,8 @@ if(WIN32)
   link_libraries(imm32 winmm dbghelp Secur32)  # missing by default :/
   if(MSVC)
     set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBUGINFO "/debug /INCREMENTAL:YES /NODEFAULTLIB:libcmt /DEFAULTLIB:msvcrt")
-    set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBUGINFO}")
-    set(CMAKE_EXE_LINKER_FLAGS_DEBUGFULL "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBUGINFO}")
+    set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:YES /NODEFAULTLIB:libcmt")
+    set(CMAKE_EXE_LINKER_FLAGS_DEBUGFULL "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
     link_libraries(Version dwmapi shlwapi)
   endif(MSVC)
   if(HAVE_SSL AND STATIC)
@@ -386,6 +399,13 @@ if(HAVE_INDICATEQT)
   add_definitions(-DXDG_APPS_INSTALL_DIR=${XDG_APPS_INSTALL_DIR})
 endif(HAVE_INDICATEQT)
 
+if(NOT WIN32)
+  check_function_exists(umask HAVE_UMASK)
+  if(HAVE_UMASK)
+    add_definitions(-DHAVE_UMASK)
+  endif(HAVE_UMASK)
+endif(NOT WIN32)
+
 # We need to create a version.gen
 # For this, we create our genversion binary and make sure it is run every time.
 add_executable(genversion ${CMAKE_SOURCE_DIR}/src/common/genversion.cpp)