CMakeBackwardCompatibilityCXX

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

在 CMake 專案中使用以下命令載入該模組:

include(CMakeBackwardCompatibilityCXX)

The following modules are included by this module:

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.

備註

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.

範例

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