[CMake] Unnecessary dependency building

William A. Hoffman billlist at nycap.rr.com
Fri Oct 22 14:26:12 EDT 2004


CMake make sure that depend information is always up-to-date.
IF FT.c changes, then you have to run depend to make sure the depend
information changed.   How can cmake tell if the change to FT.c added
more include files or not?

However, we are working on making this use a finer degree of granularity.
So, cmake would only compute the depend information for FT.c and not
for all the source files in the directory.   

 From experience it is much more painful to track down a bug cause by
a file that did not re-compile correctly because of a change than to 
wait a bit longer to make sure the depend information is accurate.
Currently, there is no way to shut of the depend step in cmake, but along
with the ability to only build depend for a single .o we plan to add the
ability to shut it off.

The new stuff is most likely 5 to 6 months away from being in a release.

-Bill


At 11:45 AM 10/22/2004, Eric Bolz wrote:
>I am using a CUSTOM_COMMAND to build a file, FT.c, from all my object files.
>FT.c depends on all of the object files and nothing depends on FT.c, except the final binary target.
>Here is the command.
>ADD_CUSTOM_COMMAND(
>   OUTPUT      ${CMAKE_BINARY_DIR}/FT.c
>   DEPENDS    ${MY_OBJECTS}         # a list of all my object files
>   COMMAND   buildFtable                    # a perl script
>   ARGS           ${MYOBJECTS}           #  list of  all object files
>)
>ADD_EXECUTABLE( my_executable  ${MY_SOURCES} FT.c)
>
>Everything works fine but cmake does an unnecessary build of the dependencies after the FT.c file is created.
>Example, say I touch a source file, src.c:
>1)  src.c is compiled into src.o
>2)  FT.c is rebuild by the CUSTOM_COMMAND
>3)  FT.c is compiled into a FT.o
>4)  cmake rebuilds the dependencies.   WHY?
>5)  My target is linked.
>
>Step 4 is completely unnecessary.  Is there a way to eliminate this unnecessary and time consuming depndency build.
>Is there a way to completely turn off dependency building so that I can type 'make depend' when I think it is necessary.
>
>Eric
>
>
>
>_______________________________________________
>CMake mailing list
>CMake at www.cmake.org
>http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list