No subject
Wed May 9 12:08:04 EDT 2012
-DCODEGEN so it won't include the generated file, which of course wouldn't
even exist on the first pass. But since CMake doesn't preprocess headers,
it creates a circular dependency situation, where the code generator
"depends" on files which it generates. This causes unnecessary rebuilds,
since the code generator gets rebuilt after every time it regenerates files.
I thought I could create a dummy "GeneratedFile.h" in the directory
containing the codegen files, and put this into the CMakeLists.txt in that
directory:
include_directories(
BEFORE
${PROJECT_SOURCE_DIR}/src/codegen
)
That seemed to work the first time -- if I looked at the codegen's
depend.make file I saw lines like "SomeUtilityFile.cpp.o:
..../codegen/GeneratedFile.h" -- the dummy version of the file.
The problem is that CMake seems to have a global dependency cache, so once
SomeUtilityFile.cpp gets built for the program, the dependency globally
changes to the real GeneratedFile.h.
Any ideas to make this work, or other ways I can work around the problem?
Thank you
-dan
--f46d04462ec8b4b05704cb308d88
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Looking at the mail archive it appears that my message was cut off. =A0The =
remainder:<br><br>From a compile standpoint, there is no problem -- the cod=
egen is built with -DCODEGEN so it won't include the generated file, wh=
ich of course wouldn't even exist on the first pass. =A0But since CMake=
doesn't preprocess headers, it creates a circular dependency situation=
, where the code generator "depends" on files which it generates.=
=A0This causes unnecessary rebuilds, since the code generator gets rebuilt=
after every time it regenerates files.<br>
<br>I thought I could create a dummy "GeneratedFile.h" in the dir=
ectory containing the codegen files, and put this into the CMakeLists.txt i=
n that directory:<br>include_directories(<br>=A0 BEFORE<br>=A0 ${PROJECT_SO=
URCE_DIR}/src/codegen<br>
)<br><br>That seemed to work the first time -- if I looked at the codegen&#=
39;s depend.make file I saw lines like "SomeUtilityFile.cpp.o: ..../co=
degen/GeneratedFile.h" -- the dummy version of the file.<br><br>The pr=
oblem is that CMake seems to have a global dependency cache, so once SomeUt=
ilityFile.cpp gets built for the program, the dependency globally changes t=
o the real GeneratedFile.h.<br>
<br>Any ideas to make this work, or other ways I can work around the proble=
m?<br><br>Thank you<br>-dan<br><br><br>
--f46d04462ec8b4b05704cb308d88--
More information about the CMake
mailing list