Looking at the mail archive it appears that my message was cut off.  The
remainder:

>From a compile standpoint, there is no problem -- the codegen is built with
-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
--

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

Reply via email to