TestForSTDNamespace.cmake 1.3 KB

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