INCLUDE(CheckCXXCompilerFlag)
INCLUDE(HextCompilerIsClangOrGcc)
IF(HEXT_COMPILER_IS_CLANG_OR_GCC)
  CHECK_CXX_COMPILER_FLAG("-std=c++1z" COMPILER_SUPPORTS_CPP1Z)
  IF(COMPILER_SUPPORTS_CPP1Z)
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z")
  ELSE(COMPILER_SUPPORTS_CPP1Z)
    MESSAGE(SEND_ERROR "${CMAKE_CXX_COMPILER} does not support the flag -std=c++1z.")
    MESSAGE(FATAL_ERROR "C++1z is required.")
  ENDIF(COMPILER_SUPPORTS_CPP1Z)
ENDIF(HEXT_COMPILER_IS_CLANG_OR_GCC)

