CMake/Tests/RunCMake/ExternalData/MissingData.cmake
Brad King ccd29b9af8 ExternalData: Warn on missing file instead of failing
When the primary source tree path named by a DATA{} reference does not
exist, produce an AUTHOR_WARNING instead of a FATAL_ERROR.  This is
useful when writing a new DATA{} reference to a test reference output
that has not been created yet.  This way the developer can run the test,
manually verify the output, and then copy it into place to provide the
reference and eliminate the warning.

If the named source tree path is expected to be a file but exists as a
directory, we still need to produce a FATAL_ERROR.
2014-04-17 09:45:09 -04:00

11 lines
367 B
CMake

include(ExternalData)
set(output "${CMAKE_SOURCE_DIR}/MissingData.txt")
ExternalData_Expand_Arguments(Data args DATA{MissingData.txt})
if("x${args}" STREQUAL "x${output}")
message(STATUS "Missing data reference correctly transformed!")
else()
message(FATAL_ERROR "Missing data reference transformed to:\n ${args}\n"
"but we expected:\n ${output}")
endif()