CMakeBackwardCompatibilityCXX — CMake 4.4.3 Documentation

# CMakeBackwardCompatibilityCXX

This module defines several backward compatibility cache variables for the `CXX` language to support early C++ (pre-C++98, ANSI C++).

Load this module in a CMake project with:

    include(CMakeBackwardCompatibilityCXX)

The following modules are included by this module:

- `TestForANSIForScope`

- `TestForANSIStreamHeaders`

- `TestForSSTREAM`

- `TestForSTDNamespace`

Additionally, the following cache variable may be defined:

`CMAKE_ANSI_CXXFLAGS`

  A space-separated string of compiler options for enabling ANSI C++ mode, if available.

Note

This module is intended for C++ code written before `C++ 98`. As of the `C++ 98` standard, these issues have been formally addressed, making such checks obsolete.

## Examples

Including this module provides backward compatibility cache variables, which can be used in C++. For example:

`CMakeLists.txt`

    include(CMakeBackwardCompatibilityCXX)
    file(
      CONFIGURE
      OUTPUT config.h
      CONTENT [[
        #cmakedefine CMAKE_NO_ANSI_FOR_SCOPE
        #cmakedefine CMAKE_NO_ANSI_STRING_STREAM
        #cmakedefine CMAKE_NO_ANSI_STREAM_HEADERS
        #cmakedefine CMAKE_NO_STD_NAMESPACE
      ]]
    )