Spec-Zone.ru › CMake

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
  ]]
)

© 2000–2026 Kitware, Inc. and Contributors
Licensed under the BSD 3-clause License.
https://cmake.org/cmake/help/latest/module/CMakeBackwardCompatibilityCXX.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API