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}) ^^^^^^^^^^^^^^^^^^^ Look at the following CMakeLists.txt for a simple example: CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(GLOBS NONE) FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include ${CMAKE_BINARY_DIR}/doc) FILE(WRITE ${CMAKE_BINARY_DIR}/include/header.h "") FILE(WRITE ${CMAKE_BINARY_DIR}/doc/latex.tex "") SET(GLOBS ${CMAKE_BINARY_DIR}/include/*.h ${CMAKE_BINARY_DIR}/doc/*.tex) # Wrong: FILE(GLOB_RECURSE RESULT1 RELATIVE ${GLOBS}) MESSAGE("RESULT1: ${RESULT1}") # Right: FILE(GLOB_RECURSE RESULT2 RELATIVE ${CMAKE_BINARY_DIR} ${GLOBS}) MESSAGE("RESULT2: ${RESULT2}") The results are: RESULT1: ../../doc/latex.tex RESULT2: include/header.h;doc/latex.tex While RESULT2 is correct, RESULT1 is ${CMAKE_BINARY_DIR}/doc/latex.tex relative to ${CMAKE_BINARY_DIR}/include/header.h, i.e. with two "../". Regards, Michael > 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 _______________________________________________ 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