mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-21 21:58:50 -05:00
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.
This commit is contained in:
@@ -23,6 +23,8 @@ ExternalData_Add_Test(Data1
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-D Data=DATA{Data.dat}
|
||||
${Data1CheckSpaces}
|
||||
-D DataMissing=DATA{DataMissing.dat}
|
||||
-D DataMissingWithAssociated=DATA{DataMissing.dat,Data.dat}
|
||||
-D SeriesA=DATA{SeriesA.dat,:}
|
||||
-D SeriesB=DATA{SeriesB.dat,:}
|
||||
-D SeriesC=DATA{SeriesC.dat,:}
|
||||
|
||||
@@ -8,6 +8,28 @@ if(DEFINED DataSpace)
|
||||
message(SEND_ERROR "Input file:\n ${DataSpace}\ndoes not have expected content, but [[${lines}]]")
|
||||
endif()
|
||||
endif()
|
||||
if(DataMissing)
|
||||
if(EXISTS "${DataMissing}")
|
||||
message(SEND_ERROR
|
||||
"Input file:\n"
|
||||
" ${DataMissing}\n"
|
||||
"exists but should not."
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
message(SEND_ERROR "DataMissing is not set!")
|
||||
endif()
|
||||
if(DataMissingWithAssociated)
|
||||
if(EXISTS "${DataMissingWithAssociated}")
|
||||
message(SEND_ERROR
|
||||
"Input file:\n"
|
||||
" ${DataMissingWithAssociated}\n"
|
||||
"exists but should not."
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
message(SEND_ERROR "DataMissingWithAssociated is not set!")
|
||||
endif()
|
||||
set(SeriesAn1 "1\\.dat")
|
||||
set(SeriesBn1 "_1\\.dat")
|
||||
set(SeriesCn1 "\\.1\\.dat")
|
||||
|
||||
Reference in New Issue
Block a user