summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CommandLine
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/CommandLine')
-rw-r--r--Tests/RunCMake/CommandLine/EnvToolchain-toolchain.cmake1
-rw-r--r--Tests/RunCMake/CommandLine/EnvToolchain.cmake3
-rw-r--r--Tests/RunCMake/CommandLine/EnvToolchainAbsolute-stdout.txt5
-rw-r--r--Tests/RunCMake/CommandLine/EnvToolchainAbsolute.cmake1
-rw-r--r--Tests/RunCMake/CommandLine/EnvToolchainIgnore-stdout.txt4
-rw-r--r--Tests/RunCMake/CommandLine/EnvToolchainIgnore.cmake1
-rw-r--r--Tests/RunCMake/CommandLine/EnvToolchainNone-stdout.txt3
-rw-r--r--Tests/RunCMake/CommandLine/EnvToolchainNone.cmake1
-rw-r--r--Tests/RunCMake/CommandLine/EnvToolchainNoneExisting-stdout.txt4
-rw-r--r--Tests/RunCMake/CommandLine/EnvToolchainRelative-stdout.txt4
-rw-r--r--Tests/RunCMake/CommandLine/EnvToolchainRelative.cmake1
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake27
12 files changed, 55 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/EnvToolchain-toolchain.cmake b/Tests/RunCMake/CommandLine/EnvToolchain-toolchain.cmake
new file mode 100644
index 0000000..d9fbd58
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvToolchain-toolchain.cmake
@@ -0,0 +1 @@
+set(ENV_TOOLCHAIN 1)
diff --git a/Tests/RunCMake/CommandLine/EnvToolchain.cmake b/Tests/RunCMake/CommandLine/EnvToolchain.cmake
new file mode 100644
index 0000000..230051d
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvToolchain.cmake
@@ -0,0 +1,3 @@
+message(STATUS "ENV{CMAKE_TOOLCHAIN_FILE}='$ENV{CMAKE_TOOLCHAIN_FILE}'")
+message(STATUS "CMAKE_TOOLCHAIN_FILE='${CMAKE_TOOLCHAIN_FILE}'")
+message(STATUS "ENV_TOOLCHAIN='${ENV_TOOLCHAIN}'")
diff --git a/Tests/RunCMake/CommandLine/EnvToolchainAbsolute-stdout.txt b/Tests/RunCMake/CommandLine/EnvToolchainAbsolute-stdout.txt
new file mode 100644
index 0000000..ab4bbde
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvToolchainAbsolute-stdout.txt
@@ -0,0 +1,5 @@
+-- ENV{CMAKE_TOOLCHAIN_FILE}='[^
+]*/Tests/RunCMake/CommandLine/EnvToolchain-toolchain.cmake'
+-- CMAKE_TOOLCHAIN_FILE='[^
+]*/Tests/RunCMake/CommandLine/EnvToolchain-toolchain.cmake'
+-- ENV_TOOLCHAIN='1'
diff --git a/Tests/RunCMake/CommandLine/EnvToolchainAbsolute.cmake b/Tests/RunCMake/CommandLine/EnvToolchainAbsolute.cmake
new file mode 100644
index 0000000..0f91b5e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvToolchainAbsolute.cmake
@@ -0,0 +1 @@
+include(EnvToolchain.cmake)
diff --git a/Tests/RunCMake/CommandLine/EnvToolchainIgnore-stdout.txt b/Tests/RunCMake/CommandLine/EnvToolchainIgnore-stdout.txt
new file mode 100644
index 0000000..4de9505
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvToolchainIgnore-stdout.txt
@@ -0,0 +1,4 @@
+-- ENV{CMAKE_TOOLCHAIN_FILE}='[^
+]*/Tests/RunCMake/CommandLine/EnvToolchain-toolchain.cmake'
+-- CMAKE_TOOLCHAIN_FILE=''
+-- ENV_TOOLCHAIN=''
diff --git a/Tests/RunCMake/CommandLine/EnvToolchainIgnore.cmake b/Tests/RunCMake/CommandLine/EnvToolchainIgnore.cmake
new file mode 100644
index 0000000..0f91b5e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvToolchainIgnore.cmake
@@ -0,0 +1 @@
+include(EnvToolchain.cmake)
diff --git a/Tests/RunCMake/CommandLine/EnvToolchainNone-stdout.txt b/Tests/RunCMake/CommandLine/EnvToolchainNone-stdout.txt
new file mode 100644
index 0000000..cfe655d
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvToolchainNone-stdout.txt
@@ -0,0 +1,3 @@
+-- ENV{CMAKE_TOOLCHAIN_FILE}=''
+-- CMAKE_TOOLCHAIN_FILE=''
+-- ENV_TOOLCHAIN=''
diff --git a/Tests/RunCMake/CommandLine/EnvToolchainNone.cmake b/Tests/RunCMake/CommandLine/EnvToolchainNone.cmake
new file mode 100644
index 0000000..0f91b5e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvToolchainNone.cmake
@@ -0,0 +1 @@
+include(EnvToolchain.cmake)
diff --git a/Tests/RunCMake/CommandLine/EnvToolchainNoneExisting-stdout.txt b/Tests/RunCMake/CommandLine/EnvToolchainNoneExisting-stdout.txt
new file mode 100644
index 0000000..4de9505
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvToolchainNoneExisting-stdout.txt
@@ -0,0 +1,4 @@
+-- ENV{CMAKE_TOOLCHAIN_FILE}='[^
+]*/Tests/RunCMake/CommandLine/EnvToolchain-toolchain.cmake'
+-- CMAKE_TOOLCHAIN_FILE=''
+-- ENV_TOOLCHAIN=''
diff --git a/Tests/RunCMake/CommandLine/EnvToolchainRelative-stdout.txt b/Tests/RunCMake/CommandLine/EnvToolchainRelative-stdout.txt
new file mode 100644
index 0000000..4bafbba
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvToolchainRelative-stdout.txt
@@ -0,0 +1,4 @@
+-- ENV{CMAKE_TOOLCHAIN_FILE}='EnvToolchain-toolchain.cmake'
+-- CMAKE_TOOLCHAIN_FILE='[^
+]*/Tests/RunCMake/CommandLine/EnvToolchainRelative-build/EnvToolchain-toolchain.cmake'
+-- ENV_TOOLCHAIN='1'
diff --git a/Tests/RunCMake/CommandLine/EnvToolchainRelative.cmake b/Tests/RunCMake/CommandLine/EnvToolchainRelative.cmake
new file mode 100644
index 0000000..0f91b5e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/EnvToolchainRelative.cmake
@@ -0,0 +1 @@
+include(EnvToolchain.cmake)
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 2eb8784..c4d3e4a 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -344,6 +344,33 @@ if(RunCMake_GENERATOR MATCHES "Unix Makefiles" OR RunCMake_GENERATOR MATCHES "Ni
run_EnvironmentExportCompileCommands()
endif()
+function(run_EnvironmentToolchain)
+ set(ENV{CMAKE_TOOLCHAIN_FILE} "${RunCMake_SOURCE_DIR}/EnvToolchain-toolchain.cmake")
+ run_cmake(EnvToolchainAbsolute)
+ run_cmake_with_options(EnvToolchainIgnore -DCMAKE_TOOLCHAIN_FILE=)
+ unset(ENV{CMAKE_TOOLCHAIN_FILE})
+
+ set(ENV{CMAKE_TOOLCHAIN_FILE} "EnvToolchain-toolchain.cmake")
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/EnvToolchainRelative-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ configure_file("${RunCMake_SOURCE_DIR}/EnvToolchain-toolchain.cmake" "${RunCMake_TEST_BINARY_DIR}/EnvToolchain-toolchain.cmake" COPYONLY)
+ run_cmake(EnvToolchainRelative)
+ unset(ENV{CMAKE_TOOLCHAIN_FILE})
+ unset(RunCMake_TEST_NO_CLEAN)
+
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/EnvToolchainNone-build)
+ run_cmake(EnvToolchainNone)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/CMakeFiles")
+ set(ENV{CMAKE_TOOLCHAIN_FILE} "${RunCMake_SOURCE_DIR}/EnvToolchain-toolchain.cmake")
+ run_cmake_command(EnvToolchainNoneExisting ${CMAKE_COMMAND} .)
+ unset(ENV{CMAKE_TOOLCHAIN_FILE})
+ unset(RunCMake_TEST_NO_CLEAN)
+endfunction()
+run_EnvironmentToolchain()
+
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)