Redesign genversion and make only main.cpp depend on it
[quassel.git] / CMakeLists.txt
index 7b8343a..be6493c 100644 (file)
@@ -16,8 +16,7 @@
 
 project(QuasselIRC)
 
-# Target scopes don't work in older versions
-cmake_minimum_required(VERSION 2.4.7 FATAL_ERROR)
+cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
 
 if(COMMAND cmake_policy)
    cmake_policy(SET CMP0003 NEW)
@@ -34,6 +33,7 @@ option(WANT_MONO     "Build the monolithic (all-in-one) binary" OFF)
 
 option(WITH_OPENSSL  "Enable OpenSSL support if present on the system" ON)
 option(WITH_DBUS     "Enable D-Bus support if present on the system"   ON)
+option(WITH_WEBKIT   "Enable WebKit support if present on the system"  ON)
 
 option(STATIC        "Enable static building (might not be portable)" OFF)
 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)
@@ -86,23 +86,6 @@ if(EXECINFO_FOUND)
   link_libraries(${EXECINFO_LIBRARIES})
 endif(EXECINFO_FOUND)
 
-# Decide what to do with icons
-if(WANT_QTCLIENT OR WANT_MONO)
-  if(QUASSEL_ICONS MATCHES "External")
-    message(STATUS "Install Quassel icons to ${CMAKE_INSTALL_PREFIX}/share/apps/quassel")
-  else(QUASSEL_ICONS MATCHES "External")
-    set(QUASSEL_ICONS "Builtin")
-    message(STATUS "Compile Quassel icons into the binary")
-  endif(QUASSEL_ICONS MATCHES "External")
-
-  if(OXYGEN_ICONS MATCHES "External")
-    message(STATUS "Use system-installed Oxygen icon theme")
-  else(OXYGEN_ICONS MATCHES "External")
-    set(OXYGEN_ICONS "Builtin")
-    message(STATUS "Compile Oxygen icon theme subset into the binary")
-  endif(OXYGEN_ICONS MATCHES "External")
-endif(WANT_QTCLIENT OR WANT_MONO)
-
 # Select a Qt installation here, if you don't want to use system Qt
 if(QT)
   # FindQt4 will look for the qmake binary in $PATH, so we just prepend the Qt dir
@@ -151,6 +134,22 @@ else(WITH_DBUS)
   message(STATUS "Disabling D-Bus support")
 endif(WITH_DBUS)
 
+# Setup QtWebKit support
+if(WITH_WEBKIT)
+  if(QT_QTWEBKIT_FOUND)
+    message(STATUS "Found QtWebKit, enabling WebKit support")
+    add_definitions(-DHAVE_WEBKIT)
+    set(LINK_WEBKIT WEBKIT)
+    set(HAVE_WEBKIT true)
+    set(MOC_DEFINES ${MOC_DEFINES} -DHAVE_WEBKIT)
+  else(QT_QTWEBKIT_FOUND)
+    message(STATUS "QtWebKit not found, disabling D-Bus support")
+  endif(QT_QTWEBKIT_FOUND)
+else(WITH_WEBKIT)
+  message(STATUS "Disabling WebKit support")
+endif(WITH_WEBKIT)
+
+
 # Set global buildflags
 # This is very much non-portable, so don't use -DSTATIC until you know what
 # you do.
@@ -170,9 +169,14 @@ if(STATIC AND WIN32)
 endif(STATIC AND WIN32)
 
 if(WIN32)
-  set(RC_WIN32 pics/win32.rc)  # for app icons on windows
+  set(RC_WIN32 ../pics/win32.rc)  # for app icons on windows
 endif(WIN32)
 
+# This is dirty, but I haven't found a cleaner way to ensure that the generated .qrc files
+# (which will be removed with make clean) are regenerated :/
+set_directory_properties(PROPERTIES
+                         ADDITIONAL_MAKE_CLEAN_FILES CMakeCache.txt)
+
 # 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)
@@ -180,17 +184,29 @@ target_link_libraries(genversion ${QT_LIBRARIES} ${QT_CORE_LIB_DEPENDENCIES})
 
 get_target_property(GENVERSION_EXECUTABLE genversion LOCATION)
 add_custom_target(genversion_run ALL ${GENVERSION_EXECUTABLE}
-                  ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/src/common/version.gen)
+                  ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/src/version.gen)
 add_dependencies(genversion_run genversion)
 
-# Generate binary translation files
-include(QuasselGenerateTranslations)
-quassel_generate_i18n_resource(RC_I18N ${LINGUAS})
+# Decide what to do with icons
+if(WANT_QTCLIENT OR WANT_MONO)
+  if(QUASSEL_ICONS MATCHES "External")
+    message(STATUS "Install Quassel icons to ${CMAKE_INSTALL_PREFIX}/share/apps/quassel")
+  else(QUASSEL_ICONS MATCHES "External")
+    set(QUASSEL_ICONS "Builtin")
+    message(STATUS "Compile Quassel icons into the binary")
+  endif(QUASSEL_ICONS MATCHES "External")
 
+  if(OXYGEN_ICONS MATCHES "External")
+    message(STATUS "Use system-installed Oxygen icon theme")
+  else(OXYGEN_ICONS MATCHES "External")
+    set(OXYGEN_ICONS "Builtin")
+    message(STATUS "Compile Oxygen icon theme subset into the binary")
+  endif(OXYGEN_ICONS MATCHES "External")
+endif(WANT_QTCLIENT OR WANT_MONO)
 
 # These variables will be added to the main targets (CORE, QTCLIENT, MONO)
 
-set(COMMON_DEPS ${RC_I18N} ${RC_WIN32})
+set(COMMON_DEPS ${RC_WIN32})
 set(CORE_DEPS )
 set(CLIENT_DEPS )
 set(KDE_DEPS )
@@ -199,8 +215,5 @@ set(KDE_DEPS )
 add_subdirectory(data)
 add_subdirectory(icons)
 #add_subdirectory(pics)
+add_subdirectory(i18n)
 add_subdirectory(src)
-
-# Make sure version.gen exists before building mod_common
-# TODO: make only main.cpp depend on that! Recompiles suck...
-add_dependencies(mod_common genversion_run)