From a00757a2d7b82f098a31270ad1c59dce6767f64b Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Wed, 18 Nov 2009 06:11:39 +0000 Subject: Add compile options for SunPro compiler and rearrange setting warnings for GCC git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@881677 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/CMakeLists.txt | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'cpp') diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt index e0d47b893b..c524550b23 100644 --- a/cpp/src/CMakeLists.txt +++ b/cpp/src/CMakeLists.txt @@ -124,8 +124,8 @@ if (ENABLE_VALGRIND AND NOT VALGRIND) message(STATUS "Can't locate the valgrind command; no run-time error detection") endif (ENABLE_VALGRIND AND NOT VALGRIND) -option(ENABLE_WARNINGS "Enable lots of compiler warnings (recommended)" ON) -if (ENABLE_WARNINGS AND CMAKE_COMPILER_IS_GNUCXX) +if (CMAKE_COMPILER_IS_GNUCXX) + set (COMPILER_FLAGS "") # Warnings: Enable as many as possible, keep the code clean. Please # do not disable warnings or remove -Werror without discussing on # qpid-dev list. @@ -134,9 +134,20 @@ if (ENABLE_WARNINGS AND CMAKE_COMPILER_IS_GNUCXX) # -Wunreachable-code -Wpadded -Winline # -Wshadow - warns about boost headers. set (WARNING_FLAGS - " -Werror -pedantic -Wall -Wextra -Wno-shadow -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wvolatile-register-var -Winvalid-pch -Wno-system-headers -Woverloaded-virtual") - set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}${WARNING_FLAGS}) -endif (ENABLE_WARNINGS AND CMAKE_COMPILER_IS_GNUCXX) + "-Werror -pedantic -Wall -Wextra -Wno-shadow -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wvolatile-register-var -Winvalid-pch -Wno-system-headers -Woverloaded-virtual") +endif (CMAKE_COMPILER_IS_GNUCXX) + +if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro) + set (COMPILER_FLAGS "-library=stlport4 -mt") + set (WARNING_FLAGS "+w2") +endif (CMAKE_CXX_COMPILER_ID STREQUAL SunPro) + +option(ENABLE_WARNINGS "Enable lots of compiler warnings (recommended)" ON) +if (NOT ENABLE_WARNINGS) + set (WARNING_FLAGS "") +endif (NOT ENABLE_WARNINGS) + +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS} ${WARNING_FLAGS}") # Expand a bit from the basic Find_Boost; be specific about what's needed. # TODO: Not all these libs are needed everywhere: -- cgit v1.2.1