[CMake] Configured C header dependency problem

Óscar Fuentes ofv at wanadoo.es
Wed Jul 28 12:20:59 EDT 2010


Eric Noulard <eric.noulard at gmail.com> writes:

> 2010/7/28 Óscar Fuentes <ofv at wanadoo.es>:
>> I'm using cmake 2.8.2 on Linux/make and on Windows/make-mingw32
>>
>> The project configures a template config.cmake producing config.h. That
>> header is included by all C files on the project.
>>
>> While building in-source, touching config.h only triggers the rebuild if
>> config.h is included as
>>
>> #include "config.h"
>>
>> but not as
>>
>> #include <config.h>
>>
>> While building out of source, touching config.h does not trigger the
>> rebuild of the C files not matter how the header is used.
>>
>> Touching any other header file triggers the rebuild of the corresponding
>> C source files.
>>
>> The project follows the pattern
>>
>> platform macros
>> configure config.cmake -> config.h (using configure_file)
>> add_subdirectory
>> add_executable(foo file1.c file2.c ...)
>
> Did you try adding the  config.h to your list of files in add_executable ?
>
> Do not forget to
> set_source_files_properties(config.h PROPERTIES GENERATED TRUE)

Thanks for the suggestions. Just tried them, separately and combined. No
change.

OTOH, I would expect from configure_file to automatically do that, and
from the depedency scanner to detect config.h.

>> This is what I do on other projects, without problems. Any suggestion?
>
> May be config.h is found in some add_executable/add_library for
> those project?

Nope.

In the C.includescache file config.h is mentioned, twice. So the
dependency scanner detects the file, but then it is ignored. The
config.h file is in D:/dev/other/emacs/qbuild/src/config.h (the build
directory.) This is an excerpt of C.includescache:

D:/dev/other/emacs/git/src/alloc.c
config.h
D:/dev/other/emacs/git/src/config.h
stdio.h
-
limits.h
-
setjmp.h
-
signal.h
-
pthread.h
-
lisp.h
D:/dev/other/emacs/git/src/lisp.h
process.h
D:/dev/other/emacs/git/src/process.h
intervals.h
D:/dev/other/emacs/git/src/intervals.h
puresize.h
D:/dev/other/emacs/git/src/puresize.h
buffer.h
D:/dev/other/emacs/git/src/buffer.h
window.h
D:/dev/other/emacs/git/src/window.h
keyboard.h
D:/dev/other/emacs/git/src/keyboard.h
frame.h
D:/dev/other/emacs/git/src/frame.h
blockinput.h
D:/dev/other/emacs/git/src/blockinput.h
character.h
D:/dev/other/emacs/git/src/character.h
syssignal.h
D:/dev/other/emacs/git/src/syssignal.h
termhooks.h
D:/dev/other/emacs/git/src/termhooks.h
setjmp.h
-
unistd.h
-
fcntl.h
-
fcntl.h
-
w32.h
D:/dev/other/emacs/git/src/w32.h
malloc.h
-
stdio.h
-



More information about the CMake mailing list