Hi list!

Hopefulle you can help me with a problem I could not figure out how to do.
With a self written preprocessor, we add some generated code to our software. This means the preprocessor is looking into the cpp files and is creating additional code depending on some special marker found in the code. For most of the files of
the project there is just nothing to create.
Because this preprocessor tool is self written, we are free to either add this generated code directly into the cpp file or to create a second module containing this code.

My problem is to find a cmake solution to start the preprocessor for all files of the project but find a clean handling for the modified ones. In short words we are searching a solution
likely the same as Qt moc.

First idea was a solution based on following thread:
http://stackoverflow.com/questions/2354473/cmake-add-custom-command
but the problem seems to be that this solution must create an additional binary for every existing cpp file because the preprocessor is executed at compile time and I have no chance to only add these files to the project that are actually generated with useful content.

Second try was the idea to add the generated code directly into the cpp file itself and call the
preprocessor with something like that:

add_custom_command(
  OUTPUT ${binCmakeTestSources}
  COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/dopoc2.bat "${binCmakeTestSources}"
  DEPENDS ${binCmakeTestSources}
)

This runs the preprocessor but the buildsystem always compiles all modules even if they are untouched.... Just two more questions: Is the Qt moc and uic handling in cmake some special implementation? Could this be easily enhanced by me with adapting macros? For me it looks like this is some special Qt code inside cmake because i couldnt find any macros and it looks like the decision if moc(uic is to be run is made at cmake run not at c++ compile time...

Maybe somebody could give me a hint...

Regards
Dietmar
_______________________________________________
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