CMakeColors.cmake 862 B

123456789101112131415161718192021222324252627282930313233
  1. if(NOT WIN32)
  2. set(_use_color ON)
  3. if("0" STREQUAL "$ENV{CLICOLOR}")
  4. set(_use_color OFF)
  5. endif()
  6. if("0" STREQUAL "$ENV{CLICOLOR_FORCE}")
  7. set(_use_color OFF)
  8. endif()
  9. if(NOT CMAKE_COLOR_MAKEFILE)
  10. set(_use_color OFF)
  11. endif()
  12. if(_use_color)
  13. string(ASCII 27 Esc)
  14. set(ColorReset "${Esc}[m")
  15. set(ColorBold "${Esc}[1m")
  16. set(Red "${Esc}[31m")
  17. set(Green "${Esc}[32m")
  18. set(Yellow "${Esc}[33m")
  19. set(Blue "${Esc}[34m")
  20. set(Magenta "${Esc}[35m")
  21. set(Cyan "${Esc}[36m")
  22. set(White "${Esc}[37m")
  23. set(BoldRed "${Esc}[1;31m")
  24. set(BoldGreen "${Esc}[1;32m")
  25. set(BoldYellow "${Esc}[1;33m")
  26. set(BoldBlue "${Esc}[1;34m")
  27. set(BoldMagenta "${Esc}[1;35m")
  28. set(BoldCyan "${Esc}[1;36m")
  29. set(BoldWhite "${Esc}[1;37m")
  30. endif()
  31. endif()