Add Linux variable and set -Werror for Linux builds.

This commit is contained in:
John Maguire 2011-02-04 12:07:00 +00:00
parent c680c55379
commit ab2f3360e2
2 changed files with 12 additions and 4 deletions

View File

@ -8,8 +8,12 @@ include(cmake/Deb.cmake)
include(cmake/Rpm.cmake) include(cmake/Rpm.cmake)
include(cmake/SipBindings.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) 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) option(ENABLE_DBUS "Enable D-Bus, MPRIS and native notifications. Required for DeviceKit and Wii remote support" ON)
if(ENABLE_DBUS) if(ENABLE_DBUS)
find_package(Qt4 REQUIRED QtDbus) find_package(Qt4 REQUIRED QtDbus)
@ -22,7 +26,7 @@ if(UNIX AND NOT APPLE)
option(ENABLE_WIIMOTEDEV "Enable Wii remote support in Clementine" ON) option(ENABLE_WIIMOTEDEV "Enable Wii remote support in Clementine" ON)
endif(ENABLE_DBUS) endif(ENABLE_DBUS)
endif(UNIX AND NOT APPLE) endif (LINUX)
if(NOT APPLE) if(NOT APPLE)
find_package(Qt4 COMPONENTS QtWebKit) find_package(Qt4 COMPONENTS QtWebKit)

View File

@ -2,6 +2,10 @@
set(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}") set(CMAKE_C_FLAGS "-Wall ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Woverloaded-virtual -Wall -Wno-sign-compare ${CMAKE_CXX_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(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(../3rdparty/gmock/gtest/include) include_directories(../3rdparty/gmock/gtest/include)
if(WIN32) if(WIN32)
@ -997,14 +1001,14 @@ if (WIN32)
) )
endif (WIN32) endif (WIN32)
if (UNIX AND NOT APPLE) if (LINUX)
# Hack: the Gold linker pays attention to the order that libraries are # 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 # 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 # 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 # they end up getting ignored. This appends them to the very end of the link
# line, ensuring they're always used. # line, ensuring they're always used.
target_link_libraries(clementine_lib -lX11 -ldl) target_link_libraries(clementine_lib -lX11 -ldl)
endif (UNIX AND NOT APPLE) endif (LINUX)
add_dependencies(clementine_lib qtsingleapplication) add_dependencies(clementine_lib qtsingleapplication)