From ab2f3360e2fadd46171af955aadb5e980ced3896 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Fri, 4 Feb 2011 12:07:00 +0000 Subject: [PATCH] Add Linux variable and set -Werror for Linux builds. --- CMakeLists.txt | 8 ++++++-- src/CMakeLists.txt | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d1c5d8f4..91091e2b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,12 @@ include(cmake/Deb.cmake) include(cmake/Rpm.cmake) include(cmake/SipBindings.cmake) +if (UNIX AND NOT APPLE) + set(LINUX 1) +endif (UNIX AND NOT APPLE) + find_package(Qt4 4.5.0 REQUIRED QtCore QtGui QtOpenGL QtSql QtNetwork QtXml) -if(UNIX AND NOT APPLE) +if (LINUX) option(ENABLE_DBUS "Enable D-Bus, MPRIS and native notifications. Required for DeviceKit and Wii remote support" ON) if(ENABLE_DBUS) find_package(Qt4 REQUIRED QtDbus) @@ -22,7 +26,7 @@ if(UNIX AND NOT APPLE) option(ENABLE_WIIMOTEDEV "Enable Wii remote support in Clementine" ON) endif(ENABLE_DBUS) -endif(UNIX AND NOT APPLE) +endif (LINUX) if(NOT APPLE) find_package(Qt4 COMPONENTS QtWebKit) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bfa2744b4..ccf531a75 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,10 @@ set(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS "-Woverloaded-virtual -Wall -Wno-sign-compare ${CMAKE_CXX_FLAGS}") +if (LINUX) + set(CMAKE_CXX_FLAGS "-Werror ${CMAKE_CXX_FLAGS}") +endif (LINUX) + include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) include_directories(../3rdparty/gmock/gtest/include) if(WIN32) @@ -997,14 +1001,14 @@ if (WIN32) ) endif (WIN32) -if (UNIX AND NOT APPLE) +if (LINUX) # Hack: the Gold linker pays attention to the order that libraries are # specified on the link line. -lX11 and -ldl are provided earlier in the link # command but they're actually used by libraries that appear after them, so # they end up getting ignored. This appends them to the very end of the link # line, ensuring they're always used. target_link_libraries(clementine_lib -lX11 -ldl) -endif (UNIX AND NOT APPLE) +endif (LINUX) add_dependencies(clementine_lib qtsingleapplication)