+# Set up OpenSSL
+find_package(OpenSSL)
+
+# Select a Qt installation here, if you don't want to use system Qt
+if(DEFINED QT)
+ # FindQt4 will look for the qmake binary in $PATH, so we just prepend the Qt dir
+ set(ENV{PATH} ${QT}/bin:$ENV{PATH})
+ #SET(QT_QMAKE_EXECUTABLE ${QT}/bin/qmake CACHE FILEPATH "" FORCE)
+endif(DEFINED QT)
+
+# Now that we have the correct $PATH, lets find Qt!
+find_package(Qt4 REQUIRED)
+
+set(QT_DONT_USE_QTGUI 1)
+include(${QT_USE_FILE})
+include_directories(${QT_INCLUDES})
+
+# 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})
+
+add_custom_target(genversion_run ALL ${CMAKE_BINARY_DIR}/genversion
+ ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/src/common/version.gen)
+add_dependencies(genversion_run genversion)
+