-# Here comes the dirty part. Our targets need different Qt4 modules, i.e. different libs
-# and defines. We can't simply include UseQt4 several times, since definitions add up.
-# We workaround this by using our own macro to figure out what to add.
-
-# This macro sets variables for additional Qt modules.
-macro(setup_qt4_variables)
- set(QUASSEL_QT_LIBRARIES )
- IF(WIN32)
- set(MAIN MAIN)
- ENDIF(WIN32)
- foreach(qtmod CORE ${ARGV} ${MAIN})
- set(QUASSEL_QT_LIBRARIES ${QUASSEL_QT_LIBRARIES} ${QT_QT${qtmod}_LIBRARY} ${QT_${qtmod}_LIB_DEPENDENCIES})
- endforeach(qtmod ${ARGV})
- set(QUASSEL_QT_LIBRARIES ${QUASSEL_QT_LIBRARIES} ${QT_LIBRARIES})
-endmacro(setup_qt4_variables)
-
-# Now we have everything, so just glue the right pieces together :)
-if(WANT_CORE)
- setup_qt4_variables(NETWORK SCRIPT SQL)
- add_executable(quasselcore ${CMAKE_SOURCE_DIR}/src/common/main.cpp
- ${RC_SQL} ${RC_I18N} ${WIN32_RC})
- set_target_properties(quasselcore PROPERTIES
- COMPILE_FLAGS "-DQT_NETWORK_LIB -DQT_SCRIPT_LIB -DQT_SQL_LIB -DBUILD_CORE")
- target_link_libraries(quasselcore mod_core mod_common
- ${QUASSEL_QT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
-endif(WANT_CORE)
-
-if(WANT_QTCLIENT)
- setup_qt4_variables(DBUS GUI NETWORK)
- add_executable(quasselclient WIN32 ${CMAKE_SOURCE_DIR}/src/common/main.cpp
- ${RC_ICONS} ${RC_QUASSEL_ICONS} ${RC_I18N} ${WIN32_RC})
- set_target_properties(quasselclient PROPERTIES
- COMPILE_FLAGS "-DQT_GUI_LIB -DQT_NETWORK_LIB -DBUILD_QTUI")
- target_link_libraries(quasselclient mod_qtui mod_uisupport mod_client mod_common
- ${QUASSEL_QT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
-endif(WANT_QTCLIENT)
-
-if(WANT_MONO)
- setup_qt4_variables(DBUS GUI NETWORK SCRIPT SQL)
- add_executable(quassel WIN32 ${CMAKE_SOURCE_DIR}/src/common/main.cpp
- ${RC_ICONS} ${RC_QUASSEL_ICONS} ${RC_SQL} ${RC_I18N} ${WIN32_RC})
- set_target_properties(quassel PROPERTIES
- COMPILE_FLAGS "-DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SCRIPT_LIB -DQT_SQL_LIB -DBUILD_MONO")
- target_link_libraries(quassel mod_qtui mod_uisupport mod_client mod_core mod_common
- ${QUASSEL_QT_LIBRARIES} ${QUASSEL_SSL_LIBRARIES})
-endif(WANT_MONO)
-
-# Build bundles for MacOSX
-if(APPLE)
- add_custom_command(TARGET quasselclient POST_BUILD
- COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
- ${CMAKE_SOURCE_DIR} "Quassel Client" quasselclient)
- add_custom_command(TARGET quassel POST_BUILD
- COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makebundle.py
- ${CMAKE_SOURCE_DIR} "Quassel" quassel)
- if(DEPLOY)
- add_custom_command(TARGET quasselclient POST_BUILD
- COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Client)
- add_custom_command(TARGET quasselcore POST_BUILD
- COMMAND ${CMAKE_SOURCE_DIR}/scripts/build/macosx_makePackage.sh Core)
- endif(DEPLOY)
-endif(APPLE)
-
-# Install rules
-if(WANT_CORE)
- install(TARGETS quasselcore
- RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
-endif(WANT_CORE)
-
-if(WANT_QTCLIENT)
- install(TARGETS quasselclient
- RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
-
- install(FILES quasselclient.desktop
- DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
-endif(WANT_QTCLIENT)
-
-if(WANT_MONO)
- install(TARGETS quassel
- RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
-
- install(FILES quassel.desktop
- DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
-endif(WANT_MONO)
+# 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)
+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/version.gen)
+add_dependencies(genversion_run genversion)
+
+# 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_WIN32})
+set(CORE_DEPS )
+set(CLIENT_DEPS )
+set(KDE_DEPS )
+
+# Add needed subdirs - the order is important, since src needs some vars set by other dirs
+add_subdirectory(data)
+add_subdirectory(icons)
+#add_subdirectory(pics)
+add_subdirectory(i18n)
+add_subdirectory(src)