Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Modules / TestForSTDNamespace.cmake
1 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2 # file Copyright.txt or https://cmake.org/licensing for details.
3
4 #[=======================================================================[.rst:
5 TestForSTDNamespace
6 -------------------
7
8 Test for std:: namespace support
9
10 check if the compiler supports std:: on stl classes
11
12 ::
13
14   CMAKE_NO_STD_NAMESPACE - defined by the results
15 #]=======================================================================]
16
17 if(NOT DEFINED CMAKE_STD_NAMESPACE)
18   message(CHECK_START "Check for STD namespace")
19   try_compile(CMAKE_STD_NAMESPACE
20     SOURCES ${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx
21     OUTPUT_VARIABLE OUTPUT)
22   if (CMAKE_STD_NAMESPACE)
23     message(CHECK_PASS "found")
24     set (CMAKE_NO_STD_NAMESPACE 0 CACHE INTERNAL
25          "Does the compiler support std::.")
26     file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
27       "Determining if the CXX compiler has std namespace passed with "
28       "the following output:\n${OUTPUT}\n\n")
29   else ()
30     message(CHECK_FAIL "not found")
31     set (CMAKE_NO_STD_NAMESPACE 1 CACHE INTERNAL
32        "Does the compiler support std::.")
33     file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
34       "Determining if the CXX compiler has std namespace failed with "
35       "the following output:\n${OUTPUT}\n\n")
36   endif ()
37 endif()
38
39
40
41