TestForSTDNamespace.cmake 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #.rst:
  2. # TestForSTDNamespace
  3. # -------------------
  4. #
  5. # Test for std:: namespace support
  6. #
  7. # check if the compiler supports std:: on stl classes
  8. #
  9. # ::
  10. #
  11. # CMAKE_NO_STD_NAMESPACE - defined by the results
  12. #=============================================================================
  13. # Copyright 2002-2009 Kitware, Inc.
  14. #
  15. # Distributed under the OSI-approved BSD License (the "License");
  16. # see accompanying file Copyright.txt for details.
  17. #
  18. # This software is distributed WITHOUT ANY WARRANTY; without even the
  19. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  20. # See the License for more information.
  21. #=============================================================================
  22. # (To distribute this file outside of CMake, substitute the full
  23. # License text for the above reference.)
  24. if(NOT DEFINED CMAKE_STD_NAMESPACE)
  25. message(STATUS "Check for STD namespace")
  26. try_compile(CMAKE_STD_NAMESPACE ${CMAKE_BINARY_DIR}
  27. ${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx
  28. OUTPUT_VARIABLE OUTPUT)
  29. if (CMAKE_STD_NAMESPACE)
  30. message(STATUS "Check for STD namespace - found")
  31. set (CMAKE_NO_STD_NAMESPACE 0 CACHE INTERNAL
  32. "Does the compiler support std::.")
  33. file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
  34. "Determining if the CXX compiler has std namespace passed with "
  35. "the following output:\n${OUTPUT}\n\n")
  36. else ()
  37. message(STATUS "Check for STD namespace - not found")
  38. set (CMAKE_NO_STD_NAMESPACE 1 CACHE INTERNAL
  39. "Does the compiler support std::.")
  40. file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
  41. "Determining if the CXX compiler has std namespace failed with "
  42. "the following output:\n${OUTPUT}\n\n")
  43. endif ()
  44. endif()