# NOTE: You should remove CMakeCache.txt if you plan to change any of these values!
+cmake_minimum_required(VERSION 2.8.9)
project(QuasselIRC)
+# Versions
+set(QUASSEL_MAJOR 0)
+set(QUASSEL_MINOR 11)
+set(QUASSEL_PATCH 0)
+set(QUASSEL_VERSION_STRING "0.11-pre")
+
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckCXXCompilerFlag)
-# For building against Qt5, we check for an even newer cmake version below!
-cmake_minimum_required(VERSION 2.8.1 FATAL_ERROR)
-
-if(COMMAND cmake_policy)
- cmake_policy(SET CMP0003 NEW)
-endif(COMMAND cmake_policy)
-
# Use our own (well, and KDE's) version of some modules
# In particular cmake's own FindQt4 and FindOpenSSL are quite buggy
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
if(CXX_W_OVERLOADED_VIRTUAL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual")
endif()
+
+ # Just for miniz
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-function -Wno-undef -fno-strict-aliasing")
endif(CMAKE_COMPILER_IS_GNUCXX)
# ... and for Clang
set(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -fno-inline")
set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline")
set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
+
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-function -Wno-undef -fno-strict-aliasing")
endif()
# Mac build stuff
endif(QT_LRELEASE_EXECUTABLE)
+# zlib for compression, however we can always fall back to miniz
+find_package(ZLIB)
+if(ZLIB_FOUND)
+ message(STATUS "Using system zlib for compression")
+ add_definitions(-DHAVE_ZLIB)
+ include_directories(${ZLIB_INCLUDE_DIRS})
+ set(COMMON_LIBRARIES ${COMMON_LIBRARIES} ${ZLIB_LIBRARIES})
+else()
+ message(STATUS "zlib NOT found, using bundled miniz for compression")
+ if(${CMAKE_SIZEOF_VOID_P} EQUAL 4)
+ message(STATUS "WARNING: This may be slow on 32 bit systems!")
+ endif()
+endif()
+
+
# Execinfo is needed for generating backtraces
find_package(ExecInfo)
if(EXECINFO_FOUND)
# Setup KDE4 support
if(WITH_KDE AND NOT WITH_QT5)
+ # KDE has overzealous CFLAGS making miniz not compile, so save our old flags
+ set(_cflags ${CMAKE_C_FLAGS})
find_package(KDE4)
if(KDE4_FOUND)
message(STATUS "Enabling KDE4 integration")
set(CLIENT_LIBRARIES ${CLIENT_LIBRARIES} ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY} ${KDE4_SOLID_LIBS} ${KDE4_KNOTIFYCONFIG_LIBRARY})
# We always use external icons for KDE4 support, since we use its iconloader rather than our own
set(EMBED_DATA OFF)
+ # Restore our old CFLAGS
+ set(CMAKE_C_FLAGS ${_cflags})
else(KDE4_FOUND)
message(STATUS "KDE4 not found, disabling KDE integration")
endif(KDE4_FOUND)
else(WITH_PHONON)
message(STATUS "Not enabling Phonon support")
endif(WITH_PHONON)
+
+ find_package(Libsnore)
+ if(LIBSNORE_FOUND)
+ add_definitions(-DHAVE_LIBSNORE)
+ set(CLIENT_LIBRARIES ${CLIENT_LIBRARIES} ${LIBSNORE_LIBRARIES})
+ set(HAVE_SNORENOTIFY true)
+ endif(LIBSNORE_FOUND)
endif(NOT HAVE_KDE)
# Setup libindicate-qt support
/System/Library/Frameworks/Foundation.framework
)
endif()
-
endif(BUILD_GUI)
# Core-only deps
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.
-
-setup_qt_variables()
-include_directories(${QUASSEL_QT_INCLUDES})
+# Generate version information from Git
+include(GetGitRevisionDescription)
+get_git_head_revision(GIT_REFSPEC GIT_HEAD)
+git_describe(GIT_DESCRIBE --long)
-add_executable(genversion ${CMAKE_SOURCE_DIR}/src/common/genversion.cpp)
-target_link_libraries(genversion ${QUASSEL_QT_LIBRARIES})
-set_target_properties(genversion PROPERTIES COMPILE_FLAGS "${QUASSEL_QT_COMPILEFLAGS}")
+# Sanitize things if we're not in a Git repo
+if(NOT GIT_HEAD OR NOT GIT_DESCRIBE)
+ set(GIT_HEAD "")
+ set(GIT_DESCRIBE "")
+endif()
-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)
+configure_file(version.h.in ${CMAKE_BINARY_DIR}/version.h @ONLY)
# These variables will be added to the main targets (CORE, QTCLIENT, MONO)
set(COMMON_DEPS ${RC_WIN32})