This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via 22d1597f20869110edca4411236e8f5263cd5ece (commit) via 6166a4a2536ec0142a12ee0ae04eee6591863e06 (commit) via dbae465c288e3240837213570b3e1e992482c180 (commit) via 7d2db56ef9735e47ccdaf8dba994ac10bc1d7ef1 (commit) from 45a48d7e23bae2590516118643d592f02f69ff4e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=22d1597f20869110edca4411236e8f5263cd5ece commit 22d1597f20869110edca4411236e8f5263cd5ece Merge: 45a48d7 6166a4a Author: Matt McCormick <matt.mccorm...@kitware.com> AuthorDate: Fri Jul 31 08:37:28 2015 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Fri Jul 31 08:37:28 2015 -0400 Merge topic 'if-test' into next 6166a4a2 ExternalProject: Silence warnings related to TEST use in if(). dbae465c CMake: Add CMP0064 for TEST operator in if() command. 7d2db56e CMake: if command understands if(TEST TestName) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6166a4a2536ec0142a12ee0ae04eee6591863e06 commit 6166a4a2536ec0142a12ee0ae04eee6591863e06 Author: Matt McCormick <matt.mccorm...@kitware.com> AuthorDate: Wed Jul 29 14:46:40 2015 -0400 Commit: Matt McCormick <matt.mccorm...@kitware.com> CommitDate: Wed Jul 29 14:46:40 2015 -0400 ExternalProject: Silence warnings related to TEST use in if(). diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index f6844be..fdb146a 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1211,7 +1211,7 @@ function(_ep_get_build_command name step cmd_var) if(step STREQUAL "INSTALL") set(args install) endif() - if(step STREQUAL "TEST") + if("x${step}x" STREQUAL "xTESTx") set(args test) endif() else() @@ -1230,7 +1230,7 @@ function(_ep_get_build_command name step cmd_var) list(APPEND args --target install) endif() # But for "TEST" drive the project with corresponding "ctest". - if(step STREQUAL "TEST") + if("x${step}x" STREQUAL "xTESTx") string(REGEX REPLACE "^(.*/)cmake([^/]*)$" "\\1ctest\\2" cmd "${cmd}") set(args "") endif() @@ -1246,7 +1246,7 @@ function(_ep_get_build_command name step cmd_var) if(step STREQUAL "INSTALL") set(args install) endif() - if(step STREQUAL "TEST") + if("x${step}x" STREQUAL "xTESTx") set(args test) endif() endif() http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dbae465c288e3240837213570b3e1e992482c180 commit dbae465c288e3240837213570b3e1e992482c180 Author: Matt McCormick <matt.mccorm...@kitware.com> AuthorDate: Tue Jul 28 22:43:59 2015 -0400 Commit: Matt McCormick <matt.mccorm...@kitware.com> CommitDate: Wed Jul 29 14:13:32 2015 -0400 CMake: Add CMP0064 for TEST operator in if() command. The new TEST operator for the if() command is not recognized until CMP0064 is set to NEW. diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 0a313cd..590f10d 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -121,3 +121,4 @@ All Policies /policy/CMP0061 /policy/CMP0062 /policy/CMP0063 + /policy/CMP0064 diff --git a/Help/policy/CMP0064.rst b/Help/policy/CMP0064.rst new file mode 100644 index 0000000..e9a061b --- /dev/null +++ b/Help/policy/CMP0064.rst @@ -0,0 +1,17 @@ +CMP0064 +------- + +Recognize ``TEST`` as a operator for the :command:`if` command. + +The ``TEST`` operator was added to the :command:`if` command to determine if a +given test name was created by the :command:`add_test` command. + +The ``OLD`` behavior for this policy is to ignore the ``TEST`` operator. +The ``NEW`` behavior is to interpret the ``TEST`` operator. + +This policy was introduced in CMake version 3.4. CMake version +|release| warns when the policy is not set and uses ``OLD`` behavior. Use +the :command:`cmake_policy()` command to set it to ``OLD`` or ``NEW`` +explicitly. + +.. include:: DEPRECATED.txt diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index bcbc3b6..7874803 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -16,7 +16,8 @@ cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile): Makefile(makefile), Policy12Status(makefile.GetPolicyStatus(cmPolicies::CMP0012)), Policy54Status(makefile.GetPolicyStatus(cmPolicies::CMP0054)), - Policy57Status(makefile.GetPolicyStatus(cmPolicies::CMP0057)) + Policy57Status(makefile.GetPolicyStatus(cmPolicies::CMP0057)), + Policy64Status(makefile.GetPolicyStatus(cmPolicies::CMP0064)) { } @@ -494,12 +495,27 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs, reducible, arg, newArgs, argP1, argP2); } // does a test exist - if (this->IsKeyword("TEST", *arg) && argP1 != newArgs.end()) + if(this->Policy64Status != cmPolicies::OLD && + this->Policy64Status != cmPolicies::WARN) { - const cmTest* haveTest = this->Makefile.GetTest(argP1->c_str()); - this->HandlePredicate( - haveTest?true:false, - reducible, arg, newArgs, argP1, argP2); + if (this->IsKeyword("TEST", *arg) && argP1 != newArgs.end()) + { + const cmTest* haveTest = this->Makefile.GetTest(argP1->c_str()); + this->HandlePredicate( + haveTest?true:false, + reducible, arg, newArgs, argP1, argP2); + } + } + else if(this->Policy64Status == cmPolicies::WARN && + this->IsKeyword("TEST", *arg)) + { + std::ostringstream e; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0064) << "\n"; + e << "TEST will be interpreted as an operator " + "when the policy is set to NEW. " + "Since the policy is not set the OLD behavior will be used."; + + this->Makefile.IssueMessage(cmake::AUTHOR_WARNING, e.str()); } // is a variable defined if (this->IsKeyword("DEFINED", *arg) && argP1 != newArgs.end()) diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h index c923d76..c4e2d11 100644 --- a/Source/cmConditionEvaluator.h +++ b/Source/cmConditionEvaluator.h @@ -94,6 +94,7 @@ private: cmPolicies::PolicyStatus Policy12Status; cmPolicies::PolicyStatus Policy54Status; cmPolicies::PolicyStatus Policy57Status; + cmPolicies::PolicyStatus Policy64Status; }; #endif diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index b783701..a791b89 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -217,6 +217,9 @@ class cmPolicy; 3, 3, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0063, \ "Honor visibility properties for all target types.", \ + 3, 3, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0064, \ + "Support new TEST if() operator.", \ 3, 3, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) 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/TestNameThatDoesNotExist.cmake b/Tests/RunCMake/if/TestNameThatDoesNotExist.cmake index 68ad6e3..74bc8b0 100644 --- a/Tests/RunCMake/if/TestNameThatDoesNotExist.cmake +++ b/Tests/RunCMake/if/TestNameThatDoesNotExist.cmake @@ -1,3 +1,4 @@ +cmake_policy(SET CMP0064 NEW) if(TEST TestThatDoesNotExist) message(FATAL_ERROR "if TestThatDoesNotExist is true") else() diff --git a/Tests/RunCMake/if/TestNameThatExists.cmake b/Tests/RunCMake/if/TestNameThatExists.cmake index e03e148..65c2b46 100644 --- a/Tests/RunCMake/if/TestNameThatExists.cmake +++ b/Tests/RunCMake/if/TestNameThatExists.cmake @@ -1,3 +1,4 @@ +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") http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7d2db56ef9735e47ccdaf8dba994ac10bc1d7ef1 commit 7d2db56ef9735e47ccdaf8dba994ac10bc1d7ef1 Author: Matt McCormick <matt.mccorm...@kitware.com> AuthorDate: Mon Dec 29 20:47:48 2014 -0500 Commit: Matt McCormick <matt.mccorm...@kitware.com> CommitDate: Wed Jul 29 14:13:32 2015 -0400 CMake: if command understands if(TEST TestName) if(TEST TestNameThatExists) will return true if a test with the name TestNameThatExists has been added with add_test. The syntax is similar to if(TARGET TargetName). diff --git a/Help/command/if.rst b/Help/command/if.rst index 396becf..2465bde 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -71,6 +71,10 @@ Possible expressions are: created by the :command:`add_executable`, :command:`add_library`, or :command:`add_custom_target` commands. +``if(TEST test-name)`` + True if the given name is an existing test name created by the + :command:`add_test` command. + ``if(EXISTS path-to-file-or-directory)`` True if the named file or directory exists. Behavior is well-defined only for full paths. diff --git a/Help/release/dev/if-TEST.rst b/Help/release/dev/if-TEST.rst new file mode 100644 index 0000000..05bf71c --- /dev/null +++ b/Help/release/dev/if-TEST.rst @@ -0,0 +1,5 @@ +if-TEST +------- + +* Add a new TEST operator to if() that evaluates to true + if a given test name has been defined. diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 420bfdf..bcbc3b6 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -493,6 +493,14 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs, this->Makefile.FindTargetToUse(argP1->GetValue())?true:false, reducible, arg, newArgs, argP1, argP2); } + // does a test exist + if (this->IsKeyword("TEST", *arg) && argP1 != newArgs.end()) + { + const cmTest* haveTest = this->Makefile.GetTest(argP1->c_str()); + this->HandlePredicate( + haveTest?true:false, + reducible, arg, newArgs, argP1, argP2); + } // is a variable defined if (this->IsKeyword("DEFINED", *arg) && argP1 != newArgs.end()) { 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..68ad6e3 --- /dev/null +++ b/Tests/RunCMake/if/TestNameThatDoesNotExist.cmake @@ -0,0 +1,5 @@ +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..e03e148 --- /dev/null +++ b/Tests/RunCMake/if/TestNameThatExists.cmake @@ -0,0 +1,6 @@ +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() ----------------------------------------------------------------------- Summary of changes: Help/command/if.rst | 4 +++ Help/manual/cmake-policies.7.rst | 1 + Help/policy/CMP0064.rst | 17 +++++++++++++ Help/release/dev/if-TEST.rst | 5 ++++ Modules/ExternalProject.cmake | 6 ++--- Source/cmConditionEvaluator.cxx | 26 +++++++++++++++++++- Source/cmConditionEvaluator.h | 1 + Source/cmPolicies.h | 3 +++ Tests/RunCMake/CMP0064/CMP0064-NEW.cmake | 5 ++++ Tests/RunCMake/CMP0064/CMP0064-OLD.cmake | 7 ++++++ Tests/RunCMake/CMP0064/CMP0064-WARN.cmake | 7 ++++++ .../{CompileDefinitions => CMP0064}/CMakeLists.txt | 0 Tests/RunCMake/CMP0064/RunCMakeTest.cmake | 5 ++++ Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/if/RunCMakeTest.cmake | 3 +++ .../if/TestNameThatDoesNotExist-stdout.txt | 1 + Tests/RunCMake/if/TestNameThatDoesNotExist.cmake | 6 +++++ Tests/RunCMake/if/TestNameThatExists-stdout.txt | 1 + Tests/RunCMake/if/TestNameThatExists.cmake | 7 ++++++ 19 files changed, 102 insertions(+), 4 deletions(-) create mode 100644 Help/policy/CMP0064.rst create mode 100644 Help/release/dev/if-TEST.rst create mode 100644 Tests/RunCMake/CMP0064/CMP0064-NEW.cmake create mode 100644 Tests/RunCMake/CMP0064/CMP0064-OLD.cmake create mode 100644 Tests/RunCMake/CMP0064/CMP0064-WARN.cmake copy Tests/RunCMake/{CompileDefinitions => CMP0064}/CMakeLists.txt (100%) create mode 100644 Tests/RunCMake/CMP0064/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/if/TestNameThatDoesNotExist-stdout.txt create mode 100644 Tests/RunCMake/if/TestNameThatDoesNotExist.cmake create mode 100644 Tests/RunCMake/if/TestNameThatExists-stdout.txt create mode 100644 Tests/RunCMake/if/TestNameThatExists.cmake hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits