14e49ed156
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). Since use of "TEST" as an argument to if() could previously be interpreted as a non-keyword argument, add policy CMP0064 to treat it as a keyword as NEW behavior.
8 lines
245 B
CMake
8 lines
245 B
CMake
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()
|