[CMake] How to INSTALL generated files

Eric Noulard eric.noulard at gmail.com
Mon Dec 4 09:07:38 EST 2006


2006/12/4, Alan W. Irwin <irwin at beluga.phys.uvic.ca>:
> Hi Eric:
>
> It appears that at least part of your problem is that you are using the
> add_custom_target command and to quote the documentation:
>
> "The target has no output file and is ALWAYS CONSIDERED OUT OF DATE"


Ok right I missed that.

[...]

> COMMAND associated with the apidoc target nothing happens for that target
> except the dependency check on ${DOXYGEN_OUTPUT}.  However, that check means
> in turn that ${DOXYGEN_EXECUTABLE} is only executed if ${DOXYGEN_OUTPUT} is
> out of date, i.e., does not exist or has an earlier date than
> ${DOXYGEN_INPUT}.
>
> I hope this suggested style helps solve your problem.

Yes it does for a part of it,
now I have an apidoc target which is run "not everytime" and that's fine
and thank you for this.

The remaining part of the problem is the 'install' part of it.
Since CMake INSTALL command are processed during CMake run time
(and not build time) but my build process generates files (doxygen
produced files).
Those files won't be installed since
CMake may well not be re-runned after the file are generated.

The CMake code used for installing files is the following:
  FILE(GLOB_RECURSE doc_files RELATIVE ${APIDOC_DIR} ${APIDOC_DIR}/*)
    FOREACH(file ${doc_files})
    GET_FILENAME_COMPONENT(file_prefix ${file} PATH)
    INSTALL(FILES ${APIDOC_DIR}/${file}
     DESTINATION doc/${file_prefix})
  ENDFOREACH(file)

So the remaining question is:

How to properly INSTALL files which are generated during build time
BUT without knowing IN ADVANCE the name of the files you want to install.
In the doxygen generated files case, I don't know the exact names of the
list (may be huge) of files that will be generated.

Eric




-- 
Erk


More information about the CMake mailing list