[CMake] One too many "../" instances in the relative paths generated by file(GLOB_RECURSE variable RELATIVE ...)

Alan W. Irwin irwin at beluga.phys.uvic.ca
Fri Mar 18 16:28:03 EDT 2011


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})

instead, and the result has one too many "../" instances in
the relative paths.  That is, when I run the custom target, the
result is

make[3]: *** No rule to make target
/home/software/plplot_svn/HEAD/plplot_cmake_qt/doc/../../include/ps.h',
needed by doc/doxygen'.  Stop.

Note, doc and include are subdirectories of the top-level source
directory, /home/software/plplot_svn/HEAD/plplot_cmake_qt so there
is one too many ../ instances in the above relative path, and I
have printed out doxygen_globs to verify that this issue
occurs for all relative paths.

Is this extra "../" issue with GLOB_RECURSE and RELATIVE for
the file command a known bug?

I happen to have run this test with cmake-2.8.4-rc2, although I
would be happy to move to 2.8.4 instead if anybody is having
trouble replicating this issue.

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
__________________________


More information about the CMake mailing list