diff options
author | Brad King <brad.king@kitware.com> | 2015-08-03 13:25:10 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-08-03 13:25:10 (GMT) |
commit | 7ac2b1256b09044b86c6bd926cc239133beab088 (patch) | |
tree | b45456f41ea1885955795ce3c65c6b29ce502884 /Tests | |
parent | 94d53d1664b1e792e8088880cfd206e8e81ff625 (diff) | |
parent | 14e49ed15615e7f2bcb58aa4540683250006f5c7 (diff) | |
download | CMake-7ac2b1256b09044b86c6bd926cc239133beab088.zip CMake-7ac2b1256b09044b86c6bd926cc239133beab088.tar.gz CMake-7ac2b1256b09044b86c6bd926cc239133beab088.tar.bz2 |
Merge topic 'if-test'
14e49ed1 if: Add "TEST <test>" condition
623dcc85 ExternalProject: Avoid if() auto-dereference of a "TEST" variable
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CMP0064/CMP0064-NEW.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0064/CMP0064-OLD.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0064/CMP0064-WARN.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0064/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0064/RunCMakeTest.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/if/RunCMakeTest.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/if/TestNameThatDoesNotExist-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/if/TestNameThatDoesNotExist.cmake | 6 | ||||
-rw-r--r-- | Tests/RunCMake/if/TestNameThatExists-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/if/TestNameThatExists.cmake | 7 |
11 files changed, 46 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0064/CMP0064-NEW.cmake b/Tests/RunCMake/CMP0064/CMP0064-NEW.cmake new file mode 100644 index 0000000..cdf50e9 --- /dev/null +++ b/Tests/RunCMake/CMP0064/CMP0064-NEW.cmake @@ -0,0 +1,5 @@ +cmake_policy(SET CMP0064 NEW) + +if(NOT TEST TestThatDoesNotExist) + message(STATUS "if NOT TestThatDoesNotExist is true") +endif() diff --git a/Tests/RunCMake/CMP0064/CMP0064-OLD.cmake b/Tests/RunCMake/CMP0064/CMP0064-OLD.cmake new file mode 100644 index 0000000..bffd3f3 --- /dev/null +++ b/Tests/RunCMake/CMP0064/CMP0064-OLD.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0064 OLD) + +if(TEST) + message(FATAL_ERROR "TEST was not recognized to be undefined") +else() + message(STATUS "TEST was treated as a variable") +endif() diff --git a/Tests/RunCMake/CMP0064/CMP0064-WARN.cmake b/Tests/RunCMake/CMP0064/CMP0064-WARN.cmake new file mode 100644 index 0000000..bffd3f3 --- /dev/null +++ b/Tests/RunCMake/CMP0064/CMP0064-WARN.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0064 OLD) + +if(TEST) + message(FATAL_ERROR "TEST was not recognized to be undefined") +else() + message(STATUS "TEST was treated as a variable") +endif() diff --git a/Tests/RunCMake/CMP0064/CMakeLists.txt b/Tests/RunCMake/CMP0064/CMakeLists.txt new file mode 100644 index 0000000..74b3ff8 --- /dev/null +++ b/Tests/RunCMake/CMP0064/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.3) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/CMP0064/RunCMakeTest.cmake b/Tests/RunCMake/CMP0064/RunCMakeTest.cmake new file mode 100644 index 0000000..26e0a91 --- /dev/null +++ b/Tests/RunCMake/CMP0064/RunCMakeTest.cmake @@ -0,0 +1,5 @@ +include(RunCMake) + +run_cmake(CMP0064-OLD) +run_cmake(CMP0064-WARN) +run_cmake(CMP0064-NEW) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 607e799..20d47b2 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -103,6 +103,7 @@ add_RunCMake_test(CMP0055) add_RunCMake_test(CMP0057) add_RunCMake_test(CMP0059) add_RunCMake_test(CMP0060) +add_RunCMake_test(CMP0064) if(CMAKE_GENERATOR MATCHES "Make") add_RunCMake_test(Make) endif() diff --git a/Tests/RunCMake/if/RunCMakeTest.cmake b/Tests/RunCMake/if/RunCMakeTest.cmake index 2c0c4d7..3f4d2a2 100644 --- a/Tests/RunCMake/if/RunCMakeTest.cmake +++ b/Tests/RunCMake/if/RunCMakeTest.cmake @@ -4,3 +4,6 @@ run_cmake(InvalidArgument1) run_cmake(IsDirectory) run_cmake(IsDirectoryLong) run_cmake(elseif-message) + +run_cmake(TestNameThatExists) +run_cmake(TestNameThatDoesNotExist) diff --git a/Tests/RunCMake/if/TestNameThatDoesNotExist-stdout.txt b/Tests/RunCMake/if/TestNameThatDoesNotExist-stdout.txt new file mode 100644 index 0000000..8874ca8 --- /dev/null +++ b/Tests/RunCMake/if/TestNameThatDoesNotExist-stdout.txt @@ -0,0 +1 @@ +TestThatDoesNotExist is false diff --git a/Tests/RunCMake/if/TestNameThatDoesNotExist.cmake b/Tests/RunCMake/if/TestNameThatDoesNotExist.cmake new file mode 100644 index 0000000..74bc8b0 --- /dev/null +++ b/Tests/RunCMake/if/TestNameThatDoesNotExist.cmake @@ -0,0 +1,6 @@ +cmake_policy(SET CMP0064 NEW) +if(TEST TestThatDoesNotExist) + message(FATAL_ERROR "if TestThatDoesNotExist is true") +else() + message(STATUS "if TestThatDoesNotExist is false") +endif() diff --git a/Tests/RunCMake/if/TestNameThatExists-stdout.txt b/Tests/RunCMake/if/TestNameThatExists-stdout.txt new file mode 100644 index 0000000..54911bc --- /dev/null +++ b/Tests/RunCMake/if/TestNameThatExists-stdout.txt @@ -0,0 +1 @@ +TestThatExists is true diff --git a/Tests/RunCMake/if/TestNameThatExists.cmake b/Tests/RunCMake/if/TestNameThatExists.cmake new file mode 100644 index 0000000..65c2b46 --- /dev/null +++ b/Tests/RunCMake/if/TestNameThatExists.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0064 NEW) +add_test(NAME TestThatExists COMMAND ${CMAKE_COMMAND} -E echo "A CMake Test") +if(TEST TestThatExists) + message(STATUS "if TestThatExists is true") +else() + message(FATAL_ERROR "if TestThatExists is false") +endif() |