+
+IF(UNIX)
+ IF(CMAKE_COMPILER_IS_GNUCC)
+ #C++11 is not supported on some platforms, disable it
+ #MESSAGE(STATUS "Setting -std=c++0x flag for the gcc...")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+
+ #Supporting test coverage checks (gcov) in the DEBUG mode
+ IF(USE_TEST_COVERAGE)
+ INCLUDE(CodeCoverage)
+ MESSAGE(STATUS "Setting flags for gcov support the gcc...")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
+ SET(CMAKE_SHARED_LINKER_FLAGS "-lgcov")
+
+ SETUP_TARGET_FOR_COVERAGE(test_coverage # Name for custom target.
+ ctest # Name of the test driver executable that runs the tests.
+ coverage) # Name of output directory.
+
+ SET(USE_TEST_COVERAGE False)
+ ENDIF(USE_TEST_COVERAGE)
+
+ #SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -E")
+ #MESSAGE(STATUS "gcc flags are: " ${CMAKE_CXX_FLAGS})
+ #MESSAGE(STATUS "linker flags are: " ${CMAKE_SHARED_LINKER_FLAGS})
+ ENDIF(CMAKE_COMPILER_IS_GNUCC)
+ENDIF(UNIX)
+
+# Set highest warnings level
+IF(MSVC)
+ IF(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
+ string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ else()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
+ endif()
+ELSE()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+ENDIF()