summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CommandLine
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/CommandLine')
-rw-r--r--Tests/RunCMake/CommandLine/EnvColorDefault.cmake6
-rw-r--r--Tests/RunCMake/CommandLine/EnvColorOn-stdout.txt1
-rw-r--r--Tests/RunCMake/CommandLine/EnvColorOn.cmake4
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake8
4 files changed, 19 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/EnvColorDefault.cmake b/Tests/RunCMake/CommandLine/EnvColorDefault.cmake
new file mode 100644
index 0000000..dc4bc98
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvColorDefault.cmake
@@ -0,0 +1,6 @@
+if(DEFINED CMAKE_COLOR_DIAGNOSTICS)
+ message(FATAL_ERROR "CMAKE_COLOR_DIAGNOSTICS incorrectly defined.")
+endif()
+if(CMAKE_GENERATOR MATCHES "Make" AND NOT DEFINED CMAKE_COLOR_MAKEFILE)
+ message(FATAL_ERROR "CMAKE_COLOR_MAKEFILE incorrectly not defined.")
+endif()
diff --git a/Tests/RunCMake/CommandLine/EnvColorOn-stdout.txt b/Tests/RunCMake/CommandLine/EnvColorOn-stdout.txt
new file mode 100644
index 0000000..885925e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvColorOn-stdout.txt
@@ -0,0 +1 @@
+-- CMAKE_COLOR_DIAGNOSTICS='ON'
diff --git a/Tests/RunCMake/CommandLine/EnvColorOn.cmake b/Tests/RunCMake/CommandLine/EnvColorOn.cmake
new file mode 100644
index 0000000..af1235d
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvColorOn.cmake
@@ -0,0 +1,4 @@
+message(STATUS "CMAKE_COLOR_DIAGNOSTICS='${CMAKE_COLOR_DIAGNOSTICS}'")
+if(DEFINED CMAKE_COLOR_MAKEFILE)
+ message(FATAL_ERROR "CMAKE_COLOR_MAKEFILE incorrectly defined.")
+endif()
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 50815a8..ef56ded 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -416,6 +416,14 @@ function(run_EnvironmentToolchain)
endfunction()
run_EnvironmentToolchain()
+function(run_EnvironmentColor)
+ set(ENV{CMAKE_COLOR_DIAGNOSTICS} "ON")
+ run_cmake(EnvColorOn)
+ unset(ENV{CMAKE_COLOR_DIAGNOSTICS})
+ run_cmake(EnvColorDefault)
+endfunction()
+run_EnvironmentColor()
+
if(RunCMake_GENERATOR STREQUAL "Ninja")
# Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Build-build)