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 b6aa7393f5501c658afc1c83001fcecec7a86e7a (commit) via 52685ecbafd9f5a59eb88830dbb6121602ea7dc7 (commit) from 45049eca97e8931721f4a371e136a012c0473e8d (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=b6aa7393f5501c658afc1c83001fcecec7a86e7a commit b6aa7393f5501c658afc1c83001fcecec7a86e7a Merge: 45049ec 52685ec Author: Matt McCormick <matt.mccorm...@kitware.com> AuthorDate: Wed Jan 21 22:45:21 2015 -0500 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Wed Jan 21 22:45:21 2015 -0500 Merge topic 'if-test' into next 52685ecb CMake: if command understands if(TEST TestName) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=52685ecbafd9f5a59eb88830dbb6121602ea7dc7 commit 52685ecbafd9f5a59eb88830dbb6121602ea7dc7 Author: Matt McCormick <matt.mccorm...@kitware.com> AuthorDate: Mon Dec 29 20:47:48 2014 -0500 Commit: Matt McCormick <matt.mccorm...@kitware.com> CommitDate: Mon Dec 29 21:08:46 2014 -0500 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 79e5d21..2caf8d3 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -70,6 +70,10 @@ Possible expressions are: created by the :command:`add_executable`, :command:`add_library`, or :command:`add_custom_target` commands. +``if(TEST test)`` + 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/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index aba26de..29a71c7 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -507,6 +507,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/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index bf23d4a..102da6b 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -21,7 +21,20 @@ if(TARGET NotATarget) message(FATAL_ERROR "if(TARGET NotATarget) returned true!") endif() - # Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to +# Test if(TEST... +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() +if(TEST TestThatDoesNotExist) + message(FATAL_ERROR "if(TestThatDoesNotExist is true") +else() + message(STATUS "if(TestThatDoesNotExist) is false") +endif() + +# Use LINK_LIBRARIES instead of TARGET_LINK_LIBRARIES to set(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared) link_libraries(${COMPLEX_LIBS}) ----------------------------------------------------------------------- Summary of changes: Help/command/if.rst | 4 ++++ Source/cmConditionEvaluator.cxx | 8 ++++++++ Tests/Complex/Executable/CMakeLists.txt | 15 ++++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits