[CMake] Generated file dependency

Nikolay Mitev face.mitev at gmail.com
Thu Apr 23 06:37:02 EDT 2009


Hi

I have the following situation:

files: test.cpp test.h

I want to process the file test.cpp with a custom pre-processor which will
generate, say, test.ii.cpp which will get compiled into libtest.a. test.cpp
just includes test.h.

This is my CMakeLists.txt file:

cmake_minimum_required(VERSION 2.6)

add_custom_command (OUTPUT test.ii.cpp
  COMMAND preprocess test.cpp test.ii.cpp
  DEPENDS test.cpp
  COMMENT "Creating test.ii.cpp"
  VERBATIM)

add_library (test test.ii.cpp)

All dandy, but when I modify test.h the preprocessing step is not run, but
just the compile step for test.ii.cpp. How can I make it so, that when the
header is modified the preprocessing and the compilation steps are both run?

Regards,
Nikolay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090423/ea96073c/attachment.htm>


More information about the CMake mailing list