X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=CMakeLists.txt;h=e5ffc94f8dff8077f79dd5ae2e561c9cc7d983fd;hp=d23405d10536fa3dbddc517cbbbb19bcdebacbbb;hb=78ebc9ede7f1f96d7549c07a8f5ce55515146061;hpb=862bfcc856d62e62617bcd3f43572968a54bb332 diff --git a/CMakeLists.txt b/CMakeLists.txt index d23405d1..e5ffc94f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,10 @@ cmake_minimum_required(VERSION 2.4.7 FATAL_ERROR) # with 2.4, so... DUH! # cmake_policy(SET CMP0003 OLD) # suppress linker warnings +# Use our own (well, KDE's) version of some modules +# In particular cmake's FindQt4 and FindOpenSSL are quite buggy +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) + # Various options and variables that can be set on the command line option(WANT_CORE "Build the core (server) binary" ON) option(WANT_QTCLIENT "Build the Qt4 GUI client binary" ON) @@ -26,29 +30,26 @@ set(STATIC 0 CACHE BOOL "Enable static building (might not be portable)") set(QT "" CACHE STRING "Path to a Qt installation to use instead of the system Qt") set(SPUTDEV CACHE STRING "Do not use!") -# Temporary -if(STATICWIN) - set(STATIC 1) -endif(STATICWIN) - if(STATIC) set(CMAKE_BUILD_TYPE Release) endif(STATIC) # Enable various flags on gcc -include(CheckCXXCompilerFlag) -check_cxx_compiler_flag(-Wall Wall) -if(Wall) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") -endif(Wall) -check_cxx_compiler_flag(-Wextra Wextra) -if(Wextra) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") -endif(Wextra) -check_cxx_compiler_flag(-ansi ansi) -if(ansi) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi") -endif(ansi) +if(CMAKE_COMPILER_IS_GNUCXX) + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag(-Wall HAVE_WALL) + if(HAVE_WALL) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + endif(HAVE_WALL) + check_cxx_compiler_flag(-Wextra HAVE_WEXTRA) + if(HAVE_WEXTRA) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") + endif(HAVE_WEXTRA) + check_cxx_compiler_flag(-ansi HAVE_ANSI) + if(HAVE_ANSI) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi") + endif(HAVE_ANSI) +endif(CMAKE_COMPILER_IS_GNUCXX) set(QT_MIN_VERSION "4.3.0") @@ -64,7 +65,6 @@ find_package(OpenSSL) if(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(QT) # Now that we have the correct $PATH, lets find Qt! @@ -77,7 +77,7 @@ 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}) +target_link_libraries(genversion ${QT_LIBRARIES} ${QT_CORE_LIB_DEPENDENCIES}) add_custom_target(genversion_run ALL ${CMAKE_BINARY_DIR}/genversion ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/src/common/version.gen)