TestForSTDNamespace.cmake 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. Test for std:: namespace support
  7. check if the compiler supports std:: on stl classes
  8. ::
  9. CMAKE_NO_STD_NAMESPACE - defined by the results
  10. #]=======================================================================]
  11. if(NOT DEFINED CMAKE_STD_NAMESPACE)
  12. message(STATUS "Check for STD namespace")
  13. try_compile(CMAKE_STD_NAMESPACE ${CMAKE_BINARY_DIR}
  14. ${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx
  15. OUTPUT_VARIABLE OUTPUT)
  16. if (CMAKE_STD_NAMESPACE)
  17. message(STATUS "Check for STD namespace - found")
  18. set (CMAKE_NO_STD_NAMESPACE 0 CACHE INTERNAL
  19. "Does the compiler support std::.")
  20. file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
  21. "Determining if the CXX compiler has std namespace passed with "
  22. "the following output:\n${OUTPUT}\n\n")
  23. else ()
  24. message(STATUS "Check for STD namespace - not found")
  25. set (CMAKE_NO_STD_NAMESPACE 1 CACHE INTERNAL
  26. "Does the compiler support std::.")
  27. file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
  28. "Determining if the CXX compiler has std namespace failed with "
  29. "the following output:\n${OUTPUT}\n\n")
  30. endif ()
  31. endif()