[CMake] cmake option to check that a command has produced the file it should has produced
Eric Noulard
eric.noulard at gmail.com
Tue Feb 17 05:43:42 EST 2009
2009/2/17 Gaëtan Lehmann <Gaetan.Lehmann at jouy.inra.fr>:
>
> Hi,
>
> I wonder, is there an option in cmake to check that a custom command has
> produced the files it should have produced?
I don't think there is such option.
However if you have the list of supposedly produced files you may
check if they have been produced with
IF(EXISTS <filename>)
ENDIF(EXISTS <filename>)
With a MACRO like:
MACRO(CheckFilesExists)
FOREACH(F ${ARGN})
IF(EXISTS ${F})
MESSAGE(STATUS "${F} exists")
ELSE(EXISTS ${F})
MESSAGE(STATUS "${F} DOES NOT exists")
ENDIF(EXISTS ${F})
ENDFOREACH(F)
ENDMACRO(CheckFilesExists)
you could check
SET(FL "exist1.txt;doesnotexists.txt")
CheckFilesExists(${FL})
My MACRO is a sample but you can
MESSAGE(FATAL_ERROR ....)
when an expected file does not exists.
> In my case, doxygen may not produce all the expected files, depending on the
> comment it finds in the source code, but install of the man pages will fail
> because of those missing files. Having those manpages listed in the expected
> output doesn't change anything.
>
> I'd really like to have an error message at build time instead of the error
> message I get at install time: it would save me a lot of time.
If you want the error to appear at build time then you'll have
to somehow add another custom command which may
cmake -P CheckFilesDoxy.cmake
the CheckFilesDoxy.cmake should be generated at CMake time
in order to contains the appropriate list of OUTPUT files used
for Doxygen custom command.
I realise it may be a bit tricky but it should work.
--
Erk
More information about the CMake
mailing list