TestForSTDNamespace.cmake 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # - Test for std:: namespace support
  2. # check if the compiler supports std:: on stl classes
  3. # CMAKE_NO_STD_NAMESPACE - defined by the results
  4. #
  5. #=============================================================================
  6. # Copyright 2002-2009 Kitware, Inc.
  7. #
  8. # Distributed under the OSI-approved BSD License (the "License");
  9. # see accompanying file Copyright.txt for details.
  10. #
  11. # This software is distributed WITHOUT ANY WARRANTY; without even the
  12. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. # See the License for more information.
  14. #=============================================================================
  15. # (To distributed this file outside of CMake, substitute the full
  16. # License text for the above reference.)
  17. IF("CMAKE_STD_NAMESPACE" MATCHES "^CMAKE_STD_NAMESPACE$")
  18. MESSAGE(STATUS "Check for STD namespace")
  19. TRY_COMPILE(CMAKE_STD_NAMESPACE ${CMAKE_BINARY_DIR}
  20. ${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx
  21. OUTPUT_VARIABLE OUTPUT)
  22. IF (CMAKE_STD_NAMESPACE)
  23. MESSAGE(STATUS "Check for STD namespace - 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 (CMAKE_STD_NAMESPACE)
  30. MESSAGE(STATUS "Check for STD namespace - 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 (CMAKE_STD_NAMESPACE)
  37. ENDIF("CMAKE_STD_NAMESPACE" MATCHES "^CMAKE_STD_NAMESPACE$")