TestForSSTREAM¶
This module checks whether the C++ standard header <sstream>
exists and
functions correctly.
Load this module in a CMake project with:
include(TestForSSTREAM)
In early versions of C++ (pre-C++98), the <sstream>
header was not
formally standardized and may not have been available.
This module defines the following cache variables:
CMAKE_NO_ANSI_STRING_STREAM
A cache variable indicating whether the
<sstream>
header is available. It will be set to value0
if<sstream>
is available (C++ 98
and newer), and to value1
if<sstream>
is missing (ANSI C++
).CMAKE_HAS_ANSI_STRING_STREAM
A cache variable that is the opposite of
CMAKE_NO_ANSI_STRING_STREAM
(true if<sstream>
is available and false if<sstream>
is missing).
備註
The <sstream>
header was formally introduced in the C++ 98
standard,
making this check obsolete for modern compilers.
範例¶
Including this module will check for <sstream>
support and define the
CMAKE_NO_ANSI_STRING_STREAM
cache variable:
CMakeLists.txt
¶include(TestForSSTREAM)
file(
CONFIGURE
OUTPUT config.h
CONTENT "#cmakedefine CMAKE_NO_ANSI_STRING_STREAM"
)
Then it can be used in a C++ program:
example.cxx
¶#include "config.h"
#ifndef CMAKE_NO_ANSI_STRING_STREAM
# include <sstream>
#endif
int main() { ... }
另請參見¶
The
CMakeBackwardCompatibilityCXX
module.