On 2011-03-19 07:32+0100 Michael Hertling wrote:

On 03/18/2011 09:28 PM, Alan W. Irwin wrote:
I am using the following CMake code fragment to collect file depends for a 
custom
target that generatates doxygen documentation:

   # Collect essentially same source code dependencies that are in Doxyfile
   # including most of the template files for configured code files.
   set(doxygen_prefixes  
"*.c;*.cc;*.cxx;*.cpp;*.c++;*.d;*.java;*.h;*.py;*.f90;*.f")
   set(doxygen_directories "libs;src;bindings;drivers;include")
   set(doxygen_globs)
   foreach(directory ${doxygen_directories})
     foreach(prefix ${doxygen_prefixes})
       list(APPEND doxygen_globs ${CMAKE_SOURCE_DIR}/${directory}/${prefix})
     endforeach(prefix ${doxygen_prefixes})
   endforeach(directory ${doxygen_directories})
   #message(STATUS "DEBUG: doxygen_globs = ${doxygen_globs}")

   file(GLOB_RECURSE doxygen_file_depends ${doxygen_globs})
   # message(STATUS "DEBUG: doxygen_file_depends = ${doxygen_file_depends}")

All is well with the file dependencies generated this way.  When I
touch (say) include/plplot.h, the doxygen documentation is regenerated
just like I want when I run the custom target.  However, I noticed
that the doxygen_globs list was getting really huge due to the
long absolute pathnames so out of curiosity I tried

file(GLOB_RECURSE doxygen_file_depends RELATIVE ${doxygen_globs})

AFAICS, the first item in doxygen_globs is taken as the path the
following items are to be relative to. You probably need to say:

file(GLOB_RECURSE doxygen_file_depends
    RELATIVE ${CMAKE_SOURCE_DIR} ${doxygen_globs})
             ^^^^^^^^^^^^^^^^^^^

Hi Michael:

Actually, the working directory for the custom command that runs
doxygen and which needs the file dependencies is the (default)
${CMAKE_CURRENT_SOURCE_DIR} for my example so I tried RELATIVE
${CMAKE_CURRENT_SOURCE_DIR} in the spirit of what you suggested, and it
works (i.e., file dependencies work) and provides much shorter paths
for each of the list elements.

Thanks for your help (especially the simple illustrative example that
clarified how to use RELATIVE).  I note the cmake documentation for
GLOB_RECURSE does say [RELATIVE path], but at one point I had
convinced myself through some experiments that were yielding no
results at all that that "path" was a misprint so I dropped it for all
further experiments.  The whole adventure illustrates the fundamental
principle of cmake debugging which is to try a simple example to
clarify documentation you don't quite understand.  That principle is
especially true in the present case because the lists involved in the
real example have several hundred elements.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to