Skip to content

Commit

Permalink
Add OVERRIDE macro, allows "override" keyword when c++11 is available
Browse files Browse the repository at this point in the history
...and no errors when compiler is not capable of c++11 builds.
  • Loading branch information
nyalldawson committed Jan 14, 2015
1 parent 8ab4472 commit 466f256
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions CMakeLists.txt
Expand Up @@ -319,6 +319,30 @@ FIND_PROGRAM(QT_LRELEASE_EXECUTABLE
NO_DEFAULT_PATH
)

#############################################################
# enable use of c++11 features where available

IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
IF (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)
SET(USE_CXX_11 TRUE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ENDIF()
ELSEIF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
SET(USE_CXX_11 TRUE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ELSE()
SET(USE_CXX_11 FALSE)
ENDIF()

#allow override keyword if available
IF (USE_CXX_11)
SET(OVERRIDEKEYWORD "override")
ELSE()
SET(OVERRIDEKEYWORD "")
ENDIF()
ADD_DEFINITIONS("-DOVERRIDE=${OVERRIDEKEYWORD}")

#############################################################
# enable warnings

Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgsvectorcolorrampv2.h
Expand Up @@ -70,7 +70,7 @@ class CORE_EXPORT QgsVectorGradientColorRampV2 : public QgsVectorColorRampV2

virtual double value( int index ) const;

virtual QColor color( double value ) const;
virtual QColor color( double value ) const OVERRIDE;

virtual QString type() const { return "gradient"; }

Expand Down

0 comments on commit 466f256

Please sign in to comment.