include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-Wall       HAS_WALL)
check_cxx_compiler_flag(-Wpedantic  HAS_WPEDANTIC)
check_cxx_compiler_flag(-g          HAS_G)
check_cxx_compiler_flag(-std=c++11  HAS_CXX11)
if (HAS_WALL AND NOT WIN32)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()
if (HAS_WPEDANTIC)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic")
endif()
if (HAS_G)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
endif()
if (HAS_CXX11)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
